WordPress.org

Support

Support » How-To and Troubleshooting » Anchor Points only on post pages

Anchor Points only on post pages

  • Hello,

    I have been researching anchor points, and how to make the page automatically scroll down to a given point on the page. Although, I am having some troubles.

    On each page, the URL ends with #video. And on every page that has a wordpress post, it automatically scrolls down to where I want it to. But, I only want the url to contain #video if it is a post page (not the index, about us, etc)

    I found this thread:
    http://wordpress.org/support/topic/move-page-down-on-load

    And so my header contains:

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

    And:
    <body onload="goToAnchor();">

    Basically, I only want it to “onload=”goToAnchor();” if the page is a page with a post on it. How would I go about doing this?

    Thanks

    Matt

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Anchor Points only on post pages’ is closed to new replies.
Skip to toolbar