I have the following jQuery code in a WordPress theme a freelancer developed for me a while back, this particular snippet is executed during pagination, once the next page is loaded, filtered
is used to select the newly loaded elements, and then this code is used to show it sliding down and then scrolls to the top of the newly added element.
jQuery(filtered).hide();
jQuery(filtered).slideToggle('normal', function() {
var pos = jQuery(filtered).offset().top+'px';
jQuery('html, body').animate({scrollTop: pos}, 800);
});
It works fine and looks good, but the problem is, once it scrolls up, and if I use the mousewheel to scroll it down, it just don't happen for a few seconds. It kind of gets stuck/flicker before it can scroll down, What is being done wrong here, is it possible for the code to be开发者_运维问答 improved ?
精彩评论