www.webdeveloper.com
Results 1 to 7 of 7

Thread: Can you have code to load a page at a certain part of the page?

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    1

    Smile 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!

    Thanks!!

    Kim

  2. #2
    Join Date
    Dec 2008
    Location
    Didim, Turkey
    Posts
    105
    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...
    HTML Code:
    <body onload="location='index.html#menu_top'">
    <div style="height:2000px;background:red;">content</div>
    <a name="menu_top">Menu</a>
    </body>
    Mike

  3. #3
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    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.
    Stephen

  4. #4
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,096
    Quote Originally Posted by k_im_me View Post
    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

  5. #5
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    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>

    <ul id="nav">
    Stephen

  6. #6
    Join Date
    Oct 2006
    Posts
    7
    Hi Felgall,

    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?

    http://www.slsnorthcoast.com/

    Thanks

  7. #7
    Join Date
    Jan 2013
    Posts
    1
    How about any way to open the main page at a certain point when entering the website. not just create the link in the page.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles