 <p>You need to make your anchor to something like </p> <pre><code>&lt;a href="2nd.html#anchor_temp"&gt;Go&lt;/a&gt; </code></pre> <p>Because you can't prevent the default scrolling behavior of the browser </p> <p>When the document is ready you need to see the hash tag value from URL then remove the _temp and then animate to it </p> <pre><code>$(document).ready(function(e){ var str= location.hash; var n=str.replace("_temp",""); $('html,body').animate({scrollTop:$(n).offset().top}, 500); }); </code></pre> <p>I hope this will help :) </p>