Advertisement
julong

my scroll-code

Sep 2nd, 2014
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. $('document').ready(function(e) {
  2. $(window).scroll(function() {
  3. if($(this).scrollTop() > 200) {
  4. $('.back-to-top').fadeIn();
  5. } else {
  6. $('.back-to-top').fadeOut();
  7. }
  8. });
  9.  
  10. $('.back-to-top').click(function() {
  11. $('body,html').animate({scrollTop:0},1500);});
  12.  
  13.  
  14. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement