• Resolved blong

    (@blong)


    When my page is loaded, I would like it to automatically move down to my post. I have seen ways to do this using anchor tags and some javascript but I can’t seem to get it to work. I don’t know if I have been placing the code in the wrong places or something. Does anyone know how to do this or know any other method?

    I am using the twenty-ten theme.

    Any help is greatly appreciated ??

Viewing 1 replies (of 1 total)
  • Thread Starter blong

    (@blong)

    Ok I figured it out.
    For anyone with the same problem here’s what I did:

    in the header, add

    <script type="text/javascript">
    
    function goToAnchor() {
    location.href ="#myAnchor";
    }
    
    </script>

    between the head tags, right after the title.

    next change the body tag from
    <body <?php body_class(); ?>>
    to
    <body onload="goToAnchor();" <?php body_class(); ?>>

    and then open loop.php and add
    <a name="myAnchor"></a>
    right before the loop begins.

    That’s it! I’m still not exactly sure what I had wrong before
    but it’s working now ??

Viewing 1 replies (of 1 total)
  • The topic ‘Move page down on load’ is closed to new replies.