javascript - scrollTop animate is laggy in chrome but works fine in firefox (background-size: cover issue?) -
edit: issue seems background-size: cover;
in css. searching remedy on google now...
this site: bitco.tk
when click link in top navigation menu should animate , scroll down elements.
it works fine in ff, ie, , safari, in chrome it's laggy/choppy. here code:
$(document).ready(function() { $('.restloc').on('click', function(e) { e.preventdefault(); $("html, body").stop().animate({ scrolltop: ($('#locinfo').offset().top) -60 }, 'slow'); }); $('.restmenu').on('click', function(e) { e.preventdefault(); $("html, body").stop().animate({ scrolltop: ($('#mlist').offset().top) -60 }, 'slow'); }); $('.restname').on('click', function(e) { e.preventdefault(); $("html, body").stop().animate({ scrolltop: 0 }, "fast"); }); });
i have tried without e.preventdefault
, .stop()
doesn't make difference.
how can fix it?
after lot of googling found issue css background
property. quickest solution found jquery plugin 'backstretch'.
Comments
Post a Comment