0

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...

mona
  • 29
  • 2

1 Answers1

1

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);
Community
  • 1
  • 1
Pedro Moreira
  • 965
  • 5
  • 8