Reputation: 33
I've been struggling to get an Animated scroll working on this site www.nicbrwn.com/dev but the scrolling only seems to work on Firefox and I need it to work on all platforms.
The jQuery I'm using to 'scroll' is here:
<script>
$(document).ready(function() {
$('a[href^="#"]').on('click', function(e) {
e.preventDefault();
var target = this.hash,
$target = $(target);
$('body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function() {
window.location.hash = target;
});
});
});
</script>
All help would be appreciated.
Upvotes: 1
Views: 626
Reputation: 12923
You need to remove overflow: auto
on the body, html
in your css. That's what's stopping it.
Upvotes: 4
Reputation: 144689
Select both html
and body
elements:
$('html, body').stop().animate({});
Upvotes: 1