Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $(document).ready(function() {
  3.   var delay = 40;
  4.   var el = $('#floater-link');
  5.   var height = el.height();
  6.   var scrollTimer = null;
  7.   var scrollPos = function() {
  8.     return $(window).scrollTop() + $(window).height() - height - 20;
  9.   };
  10.   el.appendTo($('body')).css({position: "absolute", top: scrollPos()});
  11.  
  12.   $(window).scroll(function() {
  13.     clearTimeout(scrollTimer);
  14.     el.stop();
  15.  
  16.     scrollTimer = setTimeout(function() {
  17.       // scroll stopped
  18.       bottom = null;
  19.       scrollTimer = setTimeout(function() {
  20.         el.animate({top: scrollPos()});
  21.       }, delay);
  22.     }, 600);
  23.   });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement