Can you have code to load a page at a certain part of the page?
Hi, does anyone know whether you can make a page to open at a certain part of the page?
I'm wanting to put the navigation menu (being what I want in the center when page loads) in the middle of quite a large page. The menu items will be anchored to the 4 corners of the large page..
I think it's a new concept, haven't seen it done anywhere.. so not sure if code exists..
I'm a newbie to web development, so any help/feedback would be much appreciated!
Hi, You might want to try wrapping your page-center menu in a fragment anchor then add an onload attribute to your body tag to move to the fragment. Something like this...
If the part of your content you want to jump to has an id then just include that after the # on the end of the filename in the link. You can use any id in a web page as an anchor point to jump to.
Hi, does anyone know whether you can make a page to open at a certain part of the page?
I'm wanting to put the navigation menu (being what I want in the center when page loads) in the middle of quite a large page. The menu items will be anchored to the 4 corners of the large page..
I think it's a new concept, haven't seen it done anywhere.. so not sure if code exists..
I'm a newbie to web development, so any help/feedback would be much appreciated!
Thanks!!
Kim
No, it's not new. It's just an anchor tag.
Look at the menu here to see it in action. The gray menu at the top of the page scrolls down to the content. This is done like this:
HTML Code:
<a href="http://www.yourpage.com#placeholder">Jump to spot on page</a>
Now, if you put an anchor on the page, it will jump right to that spot on the page.
HTML Code:
<a name="placeholder"></a>
Now click on this link to go to that same page, but right to the letter "M" listings: M
There is another way to do it with pixels, but if the page is really big the numbers are WAY OFF in IE and FF, so it is not at all a cross-browser solution.
Last edited by donatello; 01-07-2009 at 11:55 AM.
Reason: adding an example
You don't need the <a name> tag now that no one uses Netscape 4 any more. Any tag at all with an id will work as the destination. For example if the navgation list in the page has an id thern you don't need to change the page at all.
<a href="http://www.yourpage.com#nav">Jump to spot on page</a>
I have tried this bit of code on my page and could not get it to show the link in another table cell! It seem like a great small bit of code to use. Is it able to be used when a menu click is to load another page in a cell next to it?
Bookmarks