Skip to content Skip to sidebar Skip to footer

Smooth Scrolling For Absolute Positioned Contents

I am using this Page scroller.js to give smooth scroll effect to my page. but it won't work. Issue for this was that I was targeting the div which had position:absolute;. I still n

Solution 1:

you can use for smooth scroll

    $(document).on('click', 'a[href^="#"]', function(e) {
        var id = $(this).attr('href');
        var $id = $(id);
        if ($id.size() === 0) {
        return;
        }
        e.preventDefault();
        var pos = $(id).offset().top;
        pos = pos-95;   
        $('body, html').animate({scrollTop: pos});
    });

Post a Comment for "Smooth Scrolling For Absolute Positioned Contents"