I’ve got a DIV #alerts_wrapper on my page that is being refreshed every 5 seconds like this:
refresh_alerts = setInterval(function () {
$('#leftside div#alerts_wrapper').load('staffhome.php #alerts_container' );
}, 5000);
I’ve got a max-height on the div set to 200px, and scrolling to auto. How can I stop the div from refreshing if the user if scrolling on this div? And then if the user stops scrolling, start refreshing again??
Thanks!
Edit: Updated with new code, no need for polling just set/reset the flag when u scroll.
DEMO
———- Old post ———-
A simple polling on div scroll event will do the trick. See DEMO