Remove fixed bar from sidebar

1

I have the following code:

JAVASCRIPT

//fix lateral filter and gallery on scrolling
    $('.cd-filter-trigger').click(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');
    }

This code performs the fixation of a slash on the side (a filter), however, after the user clicks and the slash is fixed, it should continue to fix only in the (.cd-main-content) area, meanwhile. , it stays fixed on the entire side of the page .... How can I fix this?

    
asked by anonymous 11.05.2015 / 20:39

1 answer

1

Change the fixGallery function to the following code:

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');
}
    
12.05.2015 / 14:39