Difference between revisions of "Template:Groningen"

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);
   $('html,body').animateScroll (
+
  {
+
      scrollTop: $(target).offset().top - 90
+
  },1000 );
+
  
 
}
 
}
Line 1,036: Line 1,041:
 
});
 
});
  
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);
+
    }
+
}
+
  
 
</script>
 
</script>
  
 
</html>
 
</html>

Revision as of 21:01, 31 October 2017