Note that there are some explanatory texts on larger screens.

plurals
  1. POdojo animation on interrupt?
    primarykey
    data
    text
    <p>Is there an equivalent of an 'on interrupt' function when using dojo.fx animations?</p> <p>On my site, I clear an area by sliding the div off the screen to the left and then clearing the innerHTML. So that the div is available for future use in the same place, I set its final position to be equal to its original position (though it's empty and invisible, so the user doesn't see). I do this by referencing the position when the function is fired to avoid hard coding the position in.</p> <pre><code>function clear (node) { // get the current position var position = domGeom.position (node, true); // slide the calendar off the screen var anim = dojo.fx.slideTo ({ node: node, left: -2000, unit: "px" }); // attach on onEnd function dojo.connect (anim, "onEnd", function (n1, n2) { node.innerHTML = ""; // Reset the node's position domStyle.set (node, "left", position.x + "px"); }); anim.play(); } </code></pre> <p>The problem is that if the user clicks 'clear' while the function is in progress, for example if they accidentally double click, then the 'position' variable takes the value of the node mid-animation. If I later put some content in the node, it's in the wrong place, or sometimes completely off screen.</p> <p>What I was thinking of doing was adding a listener to the animation so that if it was ever interrupted, it would stop the animation and instead execute the 'onEnd' function immediately, so that the second clear function would have the correct position variable.</p> <p>Unfortunately, I can't find such a listener; could anyone point me in the right direction, or suggest an alternative solution?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload