javascript - jQuery - After refreshing the page doesn't work -
at moment, learning how write in javascript , jquery. however, wrote simple jquery code when enter page/website automatically scrolls specific div. script working fine when loading page/website , automatically scrolls div want. problem coming when refreshing browser. after refreshed page script doesn't want scroll div pointed in code. if me grateful , thank in advance.
on chrome , opera script working after refresh made. however, cannot same firefox, ie , edge.
$(document).ready(function() { $(".left_container").animate({ scrolltop: $(".home_left").offset().top }, 0); });
ps: using "left_container" instead of "html,body" because want scroll in particular div.
best regards,
george s.
some browsers save scroll position after page reloads it's not problem of code.
what can force browser instantly scroll top , animate div this:
$(document).ready(function() { $(".left_container").scrolltop(0); // go top instantly (no animation) $(".left_container").animate({ // animate down scrolltop: $(".home_left").offset().top }, 0); });
Comments
Post a Comment