• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Next/Previous Anchor Links


Levi

Moderator
Staff member
#1
I know I can just href="#div-id" to link to 'jump' to the relevant div but I can't seem to find a way to do the next/previous anchor links.... is there a simple way I just can't find or do I need to look into a javascript alternative?
 
S

Sean Lee-Amies

Guest
#3
Not entirely sure what you mean by "a way to do the next/previous anchor links" can you clarify? I'm still a bit ill which is probably why I'm getting confused :p
 

Levi

Moderator
Staff member
#4
Sean Lee-Amies said:
Not entirely sure what you mean by "a way to do the next/previous anchor links" can you clarify? I'm still a bit ill which is probably why I'm getting confused :p
.... 1 page of website, it has several subsections in div's and a button to link to each subsection. I can link the button to each subsection using 'href="#div-id' and the page will automatically jump/scroll to that section.
Is there a way to do the same without javascript that will take you to the next div... ie you're on div 1 and you press a button to go to div 2, press it on div 2 you go to div 3 and so on.

NCRPads.co.uk said:
<a href="javascript: history.go(-1)">Back</a> works well to go back.
doesn't that take you back to the previous page...like the browser back button
 

Levi

Moderator
Staff member
#6
NCRPads.co.uk said:
Yes to the previous page, isn't that what you wanted?
no... anchor links on the same page :)
This might make it easier to explain :wacko:
http://tempsite.imageresolutions.co.uk/services.html - ignore the design of the site, this isn't what it looks like any more :)
I have sub menu and when you click the link it takes you to the relevant bit of the page. On this page when you scroll down I get a 'back to the top' link on the side. I'd like to change the back to the top to a previous and next link so it will go to the next 'sub menu' item
 
S

Sean Lee-Amies

Guest
#7
I now understand what you mean, although it did take me several attempts of re-reading your post to get there. but I don't really see the need for such a thing unless your page is going to contain literally hundreds of paragraphs, which it really shouldn't, because it's going to be faster for people to simply scroll up/down than to move the mouse and click on the next/previous button.
Regardless of the practicality, CSS isn't really set up for this kind of thing. It would have to read the position of the page to determine which section a person was currently on and then set the correct page positions for the next/previous buttons. I'm pretty sure this can't be done with just CSS.
 

Levi

Moderator
Staff member
#8
it wasn't that hard to understand was it... I tried to simplify it as much as possible lol
Oh well, it was only an idea anyways and I'm not 100% sure I was going to use it, might as well use the time for something else :)