url - Stop default hashtag behavior with jquery -


I am using the following code to add a hashtag at the end of the URL. In this way, anyone can copy that URL and take them back to the page in which some divs can be viewed.

  $ ("a.live"). (Function () {window.location.hash} = 'Live'; $ ("# live") .slideDown ();});  

In this example, I have the name 'div' There is a Diva, which will slide when clicking a link, and '#live' is added to the URL. Then I have the code that checks the hash tag when the page is loaded to show the appropriate division.

My problem is, how can I stop the browser from jumping, once it is called in the 'live' device? I do not want that page to div in Scroll down, just open it and add the hashtag so that someone can copy it and show it on that page. / P>

Any suggestions?

Thank you! < / P>

Try it:

  $ ("a.live"). Click (function () {window.location.hash = 'live'; $ ("# live"). SlideDown (); Return false; // This will stop the default action;};  

Comments