Jump to content

Using the Anchor tag.


Anders Hansen
 Share

Recommended Posts

On my homepage I have several main pages with a number of images per page. Currently I have a link underneath each photo that leads to a bigger copy of the photo on another page.The link back leads to the top of the main page. What Im trying to figure out, since I do it the "ancient" way and write the code myself, is how I can anchor the back link on the fullsize photo page to an exact place beneath of the smaller copy of the photo so that anyone looking thru the photos on the main page won't have to scroll down everytime they click on the Back-link. At the moment I have 13 pages with a total of 150 images in one grouped album and 10 pages with a total of 140 images in another grouped album. Would be glad for any help in the matter.

  • Like 2
Link to comment
Share on other sites

I've dealt with this same problem as I'm sure most of us have. Any way, the acnhor is the way to go server side and javascript's the way client side. I prefer javascript because the page doesn't have to move. What's the typical situation that causes the user to loose his place ion the page? EDIT: Note: You'll probably always have some jerkiness with the anchor approach. At least I wasn't couldn't git rid of it. The anchors are sent to the top of the page. That's why I like javascript.

Edited by niche
Link to comment
Share on other sites

you can use a id as a anchor point to return you more or less where you original came from, this can be to a group of images or specific image if you are willing to add a id ref to all images , or you could use combination of the two

<a href="gallery01.htm#group01" onclick="history.back();return false;">Go back</a>

One with javascript enabled -> onclick="history.back();return false;" without href="gallery01.htm#group01" will take you back to the page at the location of element with id ref 'group01'

  • Like 1
Link to comment
Share on other sites

Let me know if you're interested in doing it with HTML instead of JavaScript. Or just research <A> and #.
The horizontal skip links work perfectly - Top, Bottom and Middle on the page. The return link on the fullsized image page to the main photo page is currently just the addie on that page so when I click on it goes to the top of the main photo page. I thought perhaps that it might be easy to anchor the return link from the fullsized page to a place just beneath the smaller version on the page so no scrolling would be necessary. Like this SMALL PHOTOfullsize >>>>>>>>>>>>>>>>>>>>> FULLSIZE PHOTOback>>>>>>>>>>>>>>>>>>>>>> - ending up as near to the smaller version as possible
Link to comment
Share on other sites

you can use a id as a anchor point to return you more or less where you original came from, this can be to a group of images or specific image if you are willing to add a id ref to all images , or you could use combination of the two
<a href="gallery01.htm#group01" onclick="history.back();return false;">Go back</a>

One with javascript enabled -> onclick="history.back();return false;" without href="gallery01.htm#group01" will take you back to the page at the location of element with id ref 'group01'

So this is the code, <a href="gallery01.htm#group01" onclick="history.back();return false;">Go back</a> I should put at the line where currently the a href with the page addie is. it looks like this - <a href="www.********/*******/groupphotopage.html"> back </a> So the actual tag for the anchor beneath the smaller photo - should it be <a name= " ">? Edited by Anders Hansen
Link to comment
Share on other sites

You use either an name attribute as in <a name="img01"></a> or id attribute<a id="img01"></a> for the bookmark location you wish to return to. On the page you are returning from you would have <a href="www.********/*******/groupphotopage.html#img01" onclick="history.back();return false;"> back </a>.

Link to comment
Share on other sites

Guest So Called

What do you think about using Highslide JS: "a JavaScript thumbnail and media viewer" ??? (Free for non-commercial use.) I don't know much about it but I've seen it used on forums before.

Link to comment
Share on other sites

I've never bothered with an html page for the full-sized images. I just use the back button.

<a href="myphoto.jpg"><img alt="myphoto.jpg" src="myphoto_thumb.jpg" width="200"/></a>

Link to comment
Share on other sites

Thanks all of you for your help in this matter. As you might now know I prefer the age old actual writing of the HTML codes - the new webdesign terminology I might have to adapt to later on. But just now I keep to this manner of creating and adapting the look of the webpage. Thanks again. Have a great day.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...