QUIS
LEGET
HAEC?

February 29th, 2012
by Robbert Broersma

Prevent default behavior with ixsl: event modes

The other day I was adding mouse wheel zooming to the 3D graph demo. It worked, but the page scrolled while zooming because that's the default action for mouse wheel events. evt.preventDefault() would fix this in JavaScript, so I implemented equivalent functionality for Frameless.

It can be done by simply adding the ev:defaultAction="cancel" attribute from the XML Events 2 working draft to the xsl:template element:

<xsl:stylesheet ... xmlns:ev="http://www.w3.org/2001/xml-events">
<xsl:template match="*"
    mode="ixsl:onmousewheel"
    ev:defaultAction="cancel">
    ...

Easy enough, right? Let me know what you think of it.

Made in Holland, 100% JavaScriptRobbert Broersma