Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).on('scroll', function(){
- (!window.requestAnimationFrame) ? fixGallery() : window.requestAnimationFrame(fixGallery);
- });
- function fixGallery() {
- var offsetTop = $('.cd-main-content').offset().top,
- scrollTop = $(window).scrollTop();
- ( scrollTop >= offsetTop ) ? $('.cd-main-content').addClass('is-fixed') : $('.cd-main-content').removeClass('is-fixed');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement