Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- var top = $('#case-info').offset().top - parseFloat($('#case-info').css('marginTop').replace(/auto/, 0));
- $(window).scroll(function (event) {
- // what the y position of the scroll is
- var y = $(this).scrollTop();
- // whether that's below the form
- if (y >= top) {
- // if so, ad the fixed class
- $('#case-info').addClass('fixed');
- } else {
- // otherwise remove it
- $('#case-info').removeClass('fixed');
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement