Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: jquery scrollbar control

  1. #1
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default jquery scrollbar control

    i have a very wide image on my landing page.
    is it possible to use jquery or any JS command to have the page focus in on the center of the page when you arrive
    so basically it would be as if the scrollbar was moved to about the middle of the page

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Code:
    <script type="text/javascript">
    window.onload = function(){
    	document.body.scrollTop = document.body.scrollHeight/4;
    	document.body.scrollLeft = document.body.scrollWidth/4;
    };
    </script>
    Jeremy | jfein.net

  3. #3
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    thanks for the help, however this seems to have issues in IE & firefox
    IE8 doesnt seem to respond
    Last edited by ggalan; 01-11-2011 at 03:26 AM.

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    It works fine in Firefox, haven't tested in IE. What browser version and operating system are you using?
    Jeremy | jfein.net

  5. #5
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    hmm, tried 64bit firefox (namoroka)
    windows 7 64bit

    http://www.howtocreate.co.uk/tutoria.../browserwindow
    Last edited by ggalan; 01-11-2011 at 03:27 AM.

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Hmm, works fine for me. The only issue with this script is that you have to play around with the /4 part :/
    Jeremy | jfein.net

  7. The Following User Says Thank You to Nile For This Useful Post:

    ggalan (01-11-2011)

  8. #7
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    ok, will keep at it

  9. #8
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Tell me if you can't figure it out
    Jeremy | jfein.net

  10. #9
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default

    can you check ie8 on your machine w/ this link please
    http://www.2020proj.com/

  11. #10
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Yeah, I see the issue. This is a little confusing to me - I didn't test different sizes of the page when I uploaded my script I only tested one. Let me work on this tomorrow. Sorry about this.
    Jeremy | jfein.net

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
  •