Before loading content into a div, save the scroll position.
var scroll_l = $('#yourdiv').scrollLeft(), scroll_t = $('#yourdiv').scrollTop();
Each time you scroll through a div, keep the sothat position by scrolling when the load is also saved.
$('#yourdiv').scroll(function() { if ($('#yourdiv').html().length) { scroll_l = $('#yourdiv').scrollLeft(); scroll_t = $('#yourdiv').scrollTop(); } });
Then load the new content and reapply the scroll position:
$('#yourdiv').load('/your/url', function() { $('#yourdiv').scrollLeft(scroll_l); $('#yourdiv').scrollTop(scroll_t); });
Alex source share