View Full Version : Need to Jump to anchor position

01-25-2007, 10:54 PM
I am using Montre (dmenu) to show hidden panels in the content area (the example is at:http://www.digitaljoe.info/testserver/products.html)

My problem is that on smaller screens (15") it is hard to tell that a hidden div has been opened.

Is it possible to add an anchor to the javascript to make the div appear and to jump to the displayed block?

01-26-2007, 06:23 PM
I think this should work. Change this link:

<a href="#" onclick="showhide('orderdetails'); return(false);">ORDER DETAILS OPEN/CLOSE</a>

<a href="#details" onclick="showhide('orderdetails'); return(false);">ORDER DETAILS OPEN/CLOSE</a>

And then above the code for the details div, put this:

<a name="details"></a>

01-27-2007, 03:10 PM
You would probably want to take out the return(false); part as well. Just to be on the safe side.

01-27-2007, 03:20 PM
Thanks for the reply jonny - I forgot to give a pointer to the Component Box - being the issue (but the OpenClose) script has the same problem. Both are applying a display:block style.

Even if I put the bookmark in visible content area (below the hidden div) for some reason the javascript used to apply the style="display:block" function is disabling the ahref=#(anchorname) navigation command.

Am not enough of a jscripter to know what is happening to what.


01-27-2007, 03:33 PM
Read my post above about the return false part. This is what is disabling your href attribute.

Hope this helps.

01-27-2007, 06:53 PM
Thanks Testingsite but I've been using that command to prevent jump to top of page - still think I have to put the anchors into an array and then call the anchor in javascript.......rather than from HTML command..

01-27-2007, 09:40 PM

found that : location.hash = 'test'; (test is the anchor tag)

will scroll the window to an anchor tag (even if it is in a hidden div)

that's one solution - Oh for a smoothe scrollllllll

01-27-2007, 09:55 PM
<a href="#details" onclick="showhide('orderdetails'); return true;">ORDER DETAILS OPEN/CLOSE</a>... will indeed work, and is also nicer for non-JS browsers.

01-30-2007, 06:50 PM
Thanks Thetestingsite:

Removing the return false statement did indeed make the show div function and anchor tag work - sorry for not listening