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

Thread: Scroll bar - set where it starts

  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Scroll bar - set where it starts

    I have a table with a horizontal scrollbar. I would like to set where the scroll bar starts when the user loads the page. Is this possible?

    In other words, if the table were, let's say, a TV guide for all of Monday and only four hours showed at a time, I want to set that the table initially shows 10am -2pm. The user could them scroll back and forth to see other hours.

    All tables/images that I see always start with the scroll bar all the way to the left.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I don't think that's possible, unless you use an iframe to contain the table.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Even with an iframe, can you determine where the scroll bars start?

    I was wondering if there was some javascript code, that scrolls?? So load the page and then instantly scroll to the correct location?

  4. #4
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    perhaps you could use scrollTo() in some way if the obj can only scroll left and right it might work.
    this works with you normal scroll bar on the actual window but if you adapt it yo something like below it might work
    eg

    document.onLoad.getElementById("id").scrollTo()

    hope it works

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    window.scrollTo() is available, as are window.pageYOffset and window.pageXOffset (Gecko) and window.document.body.scrollTop and window.document.body.scrollLeft (IE).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes but they would only scroll the main window its self.

    but im hoping the code there would get the actual element and scroll it rather than the entire page. Because thb TV guide would not take up the whole page. It would just be a part of the page.
    Last edited by .alias.; 03-26-2006 at 02:44 PM.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes but they would only scroll the main window its self.
    Or an iframe.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Mar 2006
    Location
    UK, warwickshire
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yea it would work an iframe if you wanted to do it with iframes. That would work well actualy. I hope you get it to work

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well there is the (not universally supported):

    element.scrollLeft=value

    Or, if your element is position:absolute;overflow:hidden; inside another that is position:relative; then the inner element's style.left can be set.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    When I saw this, I thought it was an easy answer, but I guess not.
    If you were doing it vertically, all you'd need to do is use targets and an anchor, but I don't know if there's an equivalent for horizontal stuff. Seems like no.

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
  •