Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function () {  
  2.               var top = $('#case-info').offset().top - parseFloat($('#case-info').css('marginTop').replace(/auto/, 0));
  3.               $(window).scroll(function (event) {
  4.                 // what the y position of the scroll is
  5.                 var y = $(this).scrollTop();
  6.              
  7.                 // whether that's below the form
  8.                 if (y >= top) {
  9.                   // if so, ad the fixed class
  10.                   $('#case-info').addClass('fixed');
  11.                 } else {
  12.                   // otherwise remove it
  13.                   $('#case-info').removeClass('fixed');
  14.                 }
  15.               });
  16.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement