Reputation: 29
A simple scroll to top effect...The code doesn't work in ie or firefox but works fine in chrome.
html like this :
<a href="#" class="scrollTop"><i class="glyphicon glyphicon-chevron-up"></i></a>
And script like this :
$(document.body).animate({
'scrollTop':'0'
},2000);
I have tried to replace$(document.body)
with $("body")
,nothing happen...
Upvotes: 0
Views: 311
Reputation: 965
I posted a similar answer on this post:
jquery to add ids to all paras to make them all linkable.
I tested the following code on Firefox and IE 10 and works fine.
$('html, body').animate({
scrollTop : 0
}, 500);
Upvotes: 1