Line 1,008: | Line 1,008: | ||
console.log(target); | console.log(target); | ||
− | $('html,body'). | + | $('html,body').animateScroll ( |
{ | { | ||
scrollTop: $(target).offset().top - 90 | scrollTop: $(target).offset().top - 90 | ||
Line 1,036: | Line 1,036: | ||
}; | }; | ||
− | + | var animateScroll = function(target, offset) { | |
+ | var is = $(document).scrollTop(); | ||
+ | var must = parseInt($(target).offset().top) + offset; | ||
+ | if (is < must) { | ||
+ | $(document).scrollTop(is+(must/200)); | ||
+ | setTimeout(function() {animateScroll(target);}, 10); | ||
+ | } | ||
+ | } | ||
/* | /* |
Revision as of 20:51, 31 October 2017