N
N
nikober2018-07-14 02:46:19
css
nikober, 2018-07-14 02:46:19

How to make a disappearing menu smooth?

Source:

$(window).scroll(function() {
    var top = $(document).scrollTop();
    if (top > 1900) $(".navbar").removeClass('fixed-top');
    else $(".navbar").addClass('fixed-top');
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Paul Denisevich, 2018-07-14
@deniamnet

Add transition: all 0.5s to the fixed-top class

B
Bondi, 2018-10-10
@Bondi

most likely transition: all .5s ease; for .fixed-top won't work, because the transition gives smoothness to the block properties, and you have the block removed .
Therefore, you need to look at what .fixed-top gives , MB there you need to set the height to 0px + opacity or visibility and then the transition will give the necessary smoothness

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question