views:

347

answers:

1

I am loading a jQuery UI window a few scrolls down from the top of the page. When it opens the Browser resets it's position to the top of the page.

If it helps just prior to the dialog loading I am inserting some HTML into the page (html for the dialog).

Does anyone know how to stop this?

Edit The answer on the question guessed what my problem was and solved it. Was invoking the link using the hash tag.

+1  A: 

If you're invoking this via the <a href='#'> tag, be sure to preventDefault on the event. Otherwise it will return you to the top of the page onClick.

$("a.myWindow").click(function(event){
  event.preventDefault();
  /* Show dialog */
});
Jonathan Sampson
Bingo. Thanks very much.
Damien
No problem. Glad I could help.
Jonathan Sampson