jquery - Doubled page scroll by javascript -
i have code
var scroll = $(window).scrolltop(); $(window).on("scroll", function () { scroll+=100; $(window).scrolltop(scroll); //* })
but code scroll window loop bottom. how make throttle in order avoid recursion ?
the goal: have 404 page , iframe index page below of 404. , when user try scroll 404 page - index pages scroll top doubled speed
to solve issue took different approach, upon scroll scrolling index location once.
var $window = $(window); var indexlocation = 505; $window.one("scroll", function(e){ if ($window.scrolltop() < indexlocation){ $("body").animate({scrolltop: indexlocation}); } });
also can check out here: http://jsfiddle.net/jsjjk/1/
Comments
Post a Comment