Line 997: | Line 997: | ||
var is = $(document).scrollTop(); | var is = $(document).scrollTop(); | ||
var must = parseInt($(target).offset().top) + offset; | var must = parseInt($(target).offset().top) + offset; | ||
+ | var setTo; | ||
if (is < must) { | if (is < must) { | ||
− | + | setTo = is+(must/200); | |
− | + | if (setTo > must) { | |
+ | setTo = must; | ||
+ | } | ||
} else if (is > must) { | } else if (is > must) { | ||
− | + | setTo = is-(must/200); | |
+ | if (setTo < must) { | ||
+ | setTo = must; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | $(document).scrollTop(setTo); | ||
+ | if (setTo != must) { | ||
setTimeout(function() {animateScroll(target, offset);}, 10); | setTimeout(function() {animateScroll(target, offset);}, 10); | ||
} | } | ||
} | } | ||
− | |||
var jump=function(e) | var jump=function(e) |
Revision as of 21:23, 31 October 2017