SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,931
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Scroll to spot on page

    After a user logs in, I want to take them back to the Comments section on my Article page.

    How do I do that when I do not want to take them to a link?


    I tried adding an anchor in an Heading like this, but NetBeans complains...

    HTML Code:
    <h3  name="comments">Comments</h3>

    Thanks,


    Debbie

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,197
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    You can simply anchor an element by an id, E.g. you can use xxx.com/mypage.php#comments then use the below

    HTML Code:
    <h3 id="comments">Comments</h3>

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,931
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris.upjohn View Post
    You can simply anchor an element by an id, E.g. you can use xxx.com/mypage.php#comments then use the below

    HTML Code:
    <h3 id="comments">Comments</h3>
    Oh, okay. I was trying to use name instead.

    Sounds good.

    Thanks,


    Debbie

  4. #4
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As Chris said, the selector (id) will help in achieving what you need. You can also use jQuery to smoothen the scrolling (or jumping).

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,317
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Yes, the name= setup is outdated now. This is one of the main uses for ids (along with JS hooks). I don't use ids for styling at all now.


Bookmarks

Posting Permissions

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