Jump to content

Recommended Posts

Hi there,

 

I have a little problem. I have this big page with all small images, and when you click it it opens a new window with the image, but bigger. But then when you go back to the previous page, the page goes back to the top, i presume due to the href='#'. How can I fix this so that the original window doesn't go to the top?

 

<a href='#' onclick=\"Popup=window.open('http://mydomain/picture.jpg','Picture')\"><img src='http://mydomain/picture.jpg' /></a>

Link to comment
https://forums.phpfreaks.com/topic/232556-onclick-goes-to-top-of-page/
Share on other sites

well what you can try is, add the following above the part of the page you want to stop.

 

<a name="activesection"></a>

 

than set the link to this:

<a href='#activesection' onclick=\"Popup=window.open('http://mydomain/picture.jpg','Picture')\"><img src='http://mydomain/picture.jpg' /></a>

 

Anyway i never work with pop ups. But I am pretty sure you now know how to link to a certain position of a page.

I thought about that too, but I was hoping there would be a way without the browser changing the position it the page is... Is there no way of doing this?

 

hmm i am not sure if there is.

well I am not sure if it is possible but if you were able to get the coordinates of the page and set those in a variable inside of a back-button this might be done without id's, but i know nothing about that, just an idea ::)

I'm pretty sure if you add "return false;" to your onclick the page won't move. Like this:

<a href='#' onclick=\"Popup=window.open('http://mydomain/picture.jpg','Picture'); return false;\"><img src='http://mydomain/picture.jpg' /></a>

 

Good one!  here is some more info on that return false; thing

http://cs110.wellesley.edu/examples/return.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.