I have got an issue with anchors links / deep linking. I have got few tabs in a page with ids such as tab1
, tab2
. When I hit the URL with anchor = "#tab2" I can select the right tab through JavaScript but the window scrolls down.
I tried to change the window.location.hash
on-the-fly and delete the id name but still the page is scrolled down. I even tried to invoke $(window).scrollTop(0)
fu开发者_如何学Cnction but it doesn't work.
Any help on it?
Well, seems like you want to do only your function in javascript and not go to link. Then add return false; to your function.
function test()
{
alert('clicked');
return false;
}
精彩评论