PDA

View Full Version : Resolved Jump to specific place on page



theremotedr
04-17-2015, 08:42 PM
I would like to ask how to correctly code the text below so i can jump to an id on the same page.

Please go here, http://www.theremotedoctor.co.uk/basic.html
Select Accessories then Audi.
This is where on the ipad after selecting Audi i require the page to jump to the named id "topnav"
Here is the line of code <li><a href="accaudi.html">Audi</a></li> but not sure how to go about it as the href is already in use.

Please advise then i can edit all the others to match.

Thanks

styxlawyer
04-17-2015, 09:01 PM
If you mean moving within a page you simply use the id name preceded by the "#" symbol. Like this:

<li><a href="#topnav">Audi</a></li>


If you are coming from another page you need to use the page reference as well:

<li><a href="accaudi.html#topnav">Audi</a></li>

theremotedr
04-17-2015, 09:20 PM
Hi,
Ive understood that and used it BUT i need to do this.
When on the ipad...
Select accessories then drop down list select Audi.
At this point the listings for Audi are down the page a little to far.
I thought that after selecting Audi the page could jump to the id "topnav" then the listings are all visable ?

And yes its on the same page just trying to get a better view of the listings after selecting the Audi.

theremotedr
04-17-2015, 09:24 PM
At the same time Audi is selected not only do i require the listings to be shown on page "which is currently all ok" but i need the page to jump to id "topnav"

BorderTerroir
04-17-2015, 09:36 PM
I'm not sure the problem is with the code. Do your clients need a logo and instructions? If you ditch the graphics will it still work?

theremotedr
04-17-2015, 09:44 PM
I would like the logos etc still to be in place.
I have seen something in the week which allowed this but cant find it now.
Cant the word Audi be kind of hyperlinked to where i need it to go ?
Grabbing at straws as i cant find where i read about it.

theremotedr
04-17-2015, 09:56 PM
I have edited the code to this
<li><a href="accaudi.html"><a href="#topnav">Audi</a></a></li>
Which sends the page to the id i require but its created another field on the page ?

styxlawyer
04-18-2015, 08:50 AM
I have edited the code to this
<li><a href="accaudi.html"><a href="#topnav">Audi</a></a></li>
Which sends the page to the id i require but its created another field on the page ?

HTML strictly forbids nested <a>..</a> elements so browser behaviour will be undefined for your construct.

Edited to add link.

See here. (http://www.w3.org/TR/html401/struct/links.html#h-12.2.2)

theremotedr
04-18-2015, 09:30 AM
I have since put the code back as it was,still looking for a way to get this small request functional.

styxlawyer
04-18-2015, 09:36 AM
I have since put the code back as it was,still looking for a way to get this small request functional.

Did you try:

<li><a href="accaudi.html#topnav">Audi</a></li>

theremotedr
04-18-2015, 05:20 PM
No,
But i have now and works a treat.

Many thanks.