Skip to content

Instantly share code, notes, and snippets.

@fearrr
Created March 13, 2017 14:38
Show Gist options
  • Select an option

  • Save fearrr/06dc7776f931169f39df07f7c1484187 to your computer and use it in GitHub Desktop.

Select an option

Save fearrr/06dc7776f931169f39df07f7c1484187 to your computer and use it in GitHub Desktop.

Revisions

  1. fearrr created this gist Mar 13, 2017.
    8 changes: 8 additions & 0 deletions jqScrollFollow.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    var $scrollingDiv = $("#scrollingDiv");

    $(window).scroll(function(){
    var $sT = $(window).scrollTop();
    $scrollingDiv
    .stop()
    .animate({"marginTop" : ($sT + 30) + "px"}, "slow");
    });