Web Analytics Made Easy -
StatCounter snap to bottom of page onload - CodingForum

Announcement

Collapse
No announcement yet.

snap to bottom of page onload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • snap to bottom of page onload

    Not sure where this needs to be asked but i figure its javascript.

    I am wanting the page to snap to the bottom (scroll all the way to the bottom) on page load only. Allowing the user to scroll up without auto snapping to the bottom again.

    Is it possible to do this ?

  • #2
    Here you go:-


    Code:
    <body onload = "pageScroll()">
    
    <script type = "text/javascript">
    function pageScroll() {
    window.scrollTo(0,5000);   // horizontal and vertical scroll position in pixels
    }
    </script>
    You will have to alter the vertical scroll value to suit the page.


    Quizmaster: What type of cat is renowned changing its spots?
    Contestant: Cheshire.
    Last edited by Philip M; Apr 4, 2009, 03:54 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

    Comment


    • #3
      ok thanks.

      im assuming the value i need to change is the pixel height of the page ??

      so therefore i'd have to manually change it since the page is populated using wordpress, etc. and would change ??

      Comment


      • #4
        Try this:-

        Code:
        <script type = "text/javascript">
        window.onload=function(){window.scrollTo(0,1000000)}
        </script>
        Last edited by Philip M; Apr 5, 2009, 01:28 PM.

        All the code given in this post has been tested and is intended to address the question asked.
        Unless stated otherwise it is not just a demonstration.

        Comment

        Working...
        X