Smooth Animated anchor Scrolling using Jquery

Hi Kids,

Here is a simple snippet to add scrolling effect with anchor and js.

$('.some_div > a').click(function(){
            $('html, body').animate({
                  scrollTop: $( $.attr(this, 'href') ).offset().top + (some_adjustments)
            }, 800);
            return false;
});

And here is for your HTML dom structure.

<div class="some_div">
        <a href="#achor">Anchor Link Here</a>
</div>


<div id="anchor">
     Your Load of BS here Kids!
</div>

Alright Kids. Enjoy! Ciao!

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *