Line 993: | Line 993: | ||
// Add smooth scrolling on all links inside the navbar | // Add smooth scrolling on all links inside the navbar | ||
+ | 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); | ||
+ | } | ||
+ | } | ||
+ | |||
var jump=function(e) | var jump=function(e) | ||
{ | { | ||
Line 1,007: | Line 1,016: | ||
console.log(target); | console.log(target); | ||
− | + | animateScroll(target, -90); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,036: | Line 1,041: | ||
}); | }); | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 21:01, 31 October 2017