$(document).ready(function(){
//pause chat updating while hover
var auto_refresh = 0;
$("#load_tweets").mouseenter(function() {
auto_refresh = window.clearInterval(auto_refresh);
auto_refresh=0;
}).mouseleave(function(){
auto_refresh = window.setInterval('displayMessages()', 2000);
});
});
the above is my code which i use to update a DIV element with a simple setineterval when the mouse is not on the div and it should clear the interval when the mouse is on the element. It does work, but is kinda qwerky as in sometimes it ignores the clearing until the page is refreshed or some time has passed I was wondering if there is a better way to do this, or a smoother way to get this done.

New Topic/Question
Reply



MultiQuote

|