textualizer icon indicating copy to clipboard operation
textualizer copied to clipboard

onComplete and onTriggered

Open danielebailo opened this issue 13 years ago • 1 comments

Can you implement the onComplete event? It would be very useful in order to execute some javascript when the animation has finished.

Also, an OnTriggered (or equivalent name) event would be useful to know when the animation begins. thanks

danielebailo avatar May 18 '12 09:05 danielebailo

Although undocumented, right now it does trigger an event when a blurb changes.

var txt = $(something).textualizer();
txt.on('textualzer.blurbchanged', function(index) { ... });

Thus, to know when you've reached the last item, you can do something like

txt.on('textualzer.blurbchanged', function(index) { 
  if (index === WHATEVER_YOUR_LAST_ARRAY_INDEX_IS) {
    // Last item reached
    // Do something
  }
});

You can leverage the above code (or variants of it), to determine when an animation begins, ends, etc.

krisk avatar May 18 '12 14:05 krisk