I have this problem with smooth scrolling on my website, where the script scrolls down to the <div>
, but if you click the same <div>
or any other <div>
, it doesn't seem to understand where the next <div>
is. Instead, it'll just bounce up and down around the same kind of area it was just at.
This is the website in question.
The script I'm using:
jQuery(document).ready(function() {
jQuery('a[href^="#"]').click(function(e) {
jQuery('#main').animate(
{
scrollTop: jQuery(this.hash).offset().top - 50
}, 1000);
return false;
e.preventDefault();
});
});
This will work fine only if I click the link when I'm at the top of the page, but won't work at all if it's from one link straight to the other.
Could someone have a look at the website and attempt to fix this please? As I'm a little out my depth with JavaScript.
Thank you.