Sometime we need to use Smooth Scrolling to id function, it will redirect to the exact point where the content is. We can add this functionality through the code snippet…
<a class="scroll" href="#comments">Scroll to comments</a>
jQuery(document).ready(function($) { $(".scroll").click(function(event){ event.preventDefault(); $('html,body').animate({scrollTop:$(this.hash).offset().top}, 500); }); });
For wordpress user can use plugins to smooth scrolling to id. There are many kind of Plugins But I prefer to use Page scroll to id. Page scroll to id is a completely highlighted module which replaces program’s “bouncing” conduct with a smooth scrolling animation, when connections with href value containing # are clicked. It gives all the fundamental instruments and propelled usefulness for single-page sites, in-page route, back-to-top connections and so on, Click here to Check the plugins.