Preventing anchor jump?
Preventing anchor jump?
You know how when you visit
http://site.com/page.html#test1 your browser jumps to #test1 automatically? Not talking about when you open page.html and THEN click an anchor to #test1. I mean typing the anchor explicitly at the end of the url before even visiting page.html. How do you prevent that jump?
Just a sample scenario, to make sure I'm being extra clear:
1) User goes to http://google.com
2) User types in address bar http://site.com/page.html#test1
3) BAM! User gets a jump to whenever #test1 is inside page.html
Also, imagine you have
- <a href="#test2"></a>
somewhere in your markup. If you add something like
- $("a").click(function() {return false;});
You prevent the jump from happening, but the URL on your address bar stops updating as well. Any ideas on how to make the URL on the address bar update on click (so it adds #test2 at the end as it would normally do) while preventing the browser jump?