Reputation: 27114
At first I thought this was the case. But evidently, it will not clearInterval
.
In order to make it accessible, I set up some namespaced global vars.
$.faux_download = {};
$.faux_download._counter = 0;
Then I seperate every detail of the hover action in separate share-able methods.
init_hover_handler: function($this, evt) {
$this = $($this);
$.faux_download._counter = setInterval(function(){ SSK.calendar.check_load_popup($this) }, 1000);
},
init_hover_out_handler: function() {
clearInterval($.faux_download._counter);
},
Now this all works here until I add objects dynamically that are to share the same functionality
To which I use the live
event to bind :
$(".extended-cell-popup:last .job a, .extended-cell-popup:last .task a").live('hover', function(evt){
SSK.calendar.init_hover_handler(this, evt);
}, function(){
SSK.calendar.init_hover_out_handler();
});
Now the mouseovers work here, but the clear interval does not seem to work with these newly created dynamic items.
However, if I were to mouseover some of the ones that loaded with the page, those would successfully clear the interval and work appropriately.
Would anyone know why this is the case ?
jQuery 1.4.4 ( Just because, don't hate me. )
Upvotes: 2
Views: 90
Reputation: 27114
Normally I'd delete this but it's actually an interesting answer.
You can not bind hover
. You must bind mouseenter
and mouseleave
.
Upvotes: 1