Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

uhbc's avatar
Level 1

Smooth scroll doesn't work with height: 100vh;

Hi, I'm using this for smooth scrolling:

   $(function() {
        $('#home a, .navbar-default a').bind('click', function(event) {
            var $anchor = $(this);
            $('html, body').stop().animate({
                scrollTop: $($anchor.attr('href')).offset().top - 49 // sticky-navbar-> 49px
            }, 1000);
            event.preventDefault();
        });
    });

I had to have height: 100vh for mobile.

When I do this, smooth scroll doesn't work as and sticky-navbar doesn't stay at where it should be.

What should I do?

0 likes
0 replies

Please or to participate in this conversation.