Posted By

maxim_ on 05/06/11


Tagged

events clone unbind jqzoom


Versions (?)

Store DOM object's events for later reuse, aka temporary unbind (jqzoom)


 / Published in: jQuery
 

I needed to temporarily unbind jqZoom plugin events from a DOM-element and store them for later use. That's what worked for me. Any comments and suggestions would be much appreciated!

  1. var zoomEvents = $.extend(true,{},jqzoom.data('events')); //deep copy of an event object
  2.  
  3. jqzoom.trigger('mouseleave'); // this just emulates mouseleave event in order to hide zoom box
  4. jqzoom.unbind();
  5.  
  6. for (i in zoomEvents) {
  7. var evt = zoomEvents[i];
  8. for (k in evt) {
  9. jqzoom.bind(evt[k].type, evt[k].handler)
  10. }
  11. }

Report this snippet  

You need to login to post a comment.