I have an internal link on my html page. Two things happen on clicking an internal link.
- Page is scrolled (jumped) so that the target of the link is at the top of the page.
- url reflects the internal link clicked by showing /abc/#...
I noticed that the order of these two steps is also the same. i.e. hashchange
is fired after the scrolling has happened. I want to prevent the scrolling but allow hashchange
to occur. If I write an onclick
event to return false (i.e. block it) then even the hashchange
event is not fired. Any suggestions how else it could be done?