A
A
Alexander Babiy2018-12-21 00:34:30
JavaScript
Alexander Babiy, 2018-12-21 00:34:30

After the appearance of the lightbox, the fixation of the block when scrolling stops working. What could be wrong?

Good afternoon!
There is a menu block on the page, which is fixed when scrolling by adding a class with position:fixed.
When scrolling in the opposite direction, the class is removed and the menu falls into its place in the DOM tree
The problem is the following: when you click on the picture, a lightbox appears with a picture in high resolution. After closing the lightbox, the scroll stops working. Why is this happening? How to fix?
Scroll code

var heightOne = $('#one').height();

    $(window).scroll(function(){

    console.log('Высота первой секции ' + heightOne);

        if($(this).scrollTop()>heightOne){
            $('#navigation').addClass('fixed');
            $('#two').css("padding-top" , '200px');
        }
        else if ($(this).scrollTop()<heightOne){
            $('#navigation').removeClass('fixed');
            $('#two').css("padding-top" , "0");
        }
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Chuprik, 2018-12-23
@ABabiy

You have a snippet in your code . Since your code is not formatted, so it’s difficult for your hands to find it, but this is line 791. In short, find this piece and delete it. $(window).unbind('scroll');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question