I have the following jQuery code–
$('div#mid_number_of_mail').mouseover(function () {
setTimeout(function () {
$('div.element_popup' ,this).stop().animate({
opacity : '1'
}, 250, 'linear', function() { });
}, 5000);
});
But I don’t know why it is not working properly. Can someone help me with this code?
Thanks in advance!
Because
thisiswindownot the div with the given id.thisis context sensitive based on how the function is called.Since the function is called via
setTimout, it doesn’t have an object context so uses the default object:window.You want
thisas it is for the mouseover function, so you need to save a copy of it in a different variable.