samedi 14 février 2015

jQuery - Attaching and removing multiple resize events [duplicate]


This question already has an answer here:




I am working on a SPA (Single Page App) in Ember.js.


Some of my pages require JS to resize elements depending on the screen size.


As you move between pages you are meant to tidy up after yourself using the willDestroyElement function.


This is all well and good, but I have on several functions attached to the $(window) property.


If I do the following:



$(window).off('resize');


inside the willDestroyElement function it also disables all the resize events.


How can I turn on and off certain resize events on the $(window) property?





Aucun commentaire:

Enregistrer un commentaire