Search code examples
javascriptwindows-store-appswinjs

Call pointerUp Animation When Mouse Moves Away From Button


I have an anchor tag <a> with display:block; hooked up to a mousedown pointerDown animation. I'm currently running a pointerUp animation when the click event registers, which works great, until you press down the mouse button, drag your mouse off of the link, and the animation gets stuck.

Is there an event listener that fires when your mouse button is still depressed but your cursor leaves the bounding box of an element? Or is there something else I can call that will "unpress" the button?


Solution

  • You want the pointerOut event, see http://msdn.microsoft.com/library/windows/apps/hh465904.aspx. If you want the full story on pointer events, see my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript, 2nd Edition, in Chapter 12.