Click Anchor tag to Smooth Scroll to a Div
Sometimes we need our custome CSS trick to create our website more beautiful & attractive. jQuery handles this event perfectly. Today I’m giving a solution that, I try to create a smooth scrolling.
At the header of my website, I create an anchor tag that trigger to a specific div.
<a herf="#requestdiv"></a>
<div id="#requestdiv"></div>
The above code indicates an anchor tag which refers to a div tag.
Now we create the script for smooth scrolling.
<script>
$('a[href=#requestdiv]').click(function(){
$('html, body').animate({
scrollTop: $("#requestdiv").offset().top
}, 2000);
});
</script>
I think this small thing will help you.