12 Nov 2013
JQuery – How go to anchor tag without showing hashtag in URL
We use named anchors or # tags to access certain part of a page like http://www.example.com#middle. Now clicking on this tag will take user to this tag but it will show whole url in address bar.
If we want not to show # url in address bar but want to use named anchors. Use Jquery to accomplish this.
function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
Just pass the id of the element you wish to scroll to.