/ Published in: Other
Expand |
Embed | Plain Text
var $comment = $('.def_index'), top = $comment.offset().top - parseFloat($comment.css('marginTop').replace(/auto/, 0)), $window = $(window); $window.scroll(function (event) { // what the y position of the scroll is var y = $window.scrollTop(); // whether that's below the form if (y >= top) { // if so, ad the fixed class $comment.addClass('fixed'); } else { // otherwise remove it $comment.removeClass('fixed'); } });
You need to login to post a comment.
