Results 1 to 5 of 5

Thread: document.scrollbypages() working only in Firefox/Mozilla?

  1. #1
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default document.scrollbypages() working only in Firefox/Mozilla?

    I am trying to make a content of a iframe always scrolled all the way to the bottom. I have found some info on the web about positioning a page content in the iframe but I figured that simply putting document.scrollbypages(1) in the content would do the trick (the content is not that big).
    And it does work beautifully, except for the fact that it seems to be working in FireFox only (and Mozilla I'm assuming). It doesn't seem to work in Safari and Opera. I also tried to put the function in the main page, and it still fails. Is there something obvious that I'm missing? Is there maybe a better way to accomplish the same effect? Thanks!

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Riba
    I am trying to make a content of a iframe always scrolled all the way to the bottom.
    If you really mean always, then you'd be better off reorganising the content (reversing it) so that the scrolling isn't necessary.

    document.scrollbypages(1)
    There's a scrollByPages method on the global (window) object, but not on the document.

    And it does work beautifully, except for the fact that it seems to be working in FireFox only (and Mozilla I'm assuming). It doesn't seem to work in Safari and Opera. [...] Is there something obvious that I'm missing?
    It's a proprietary method that is implemented by Gecko-based browsers, but not likely anything else.

    Is there maybe a better way to accomplish the same effect?
    The best way is to restructure (as I said previously). You could try putting an anchor in the framed document then executing:

    Code:
    location.hash = '#the-anchor';
    at the end of the document, but I think that's a nasty solution, too.

    Mike

  3. #3
    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

    How about:

    <body onload="window.scrollBy(0,20000)">

    on the page inside the iframe?
    - John
    ________________________

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

  4. #4
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks mwinter for confirming what I suspected. I actually thought initially about using an anchor so I might go back to that idea. I know that it's nasty solution, but my experience has taught me that if it takes a nasty solution that works in most browsers to achieve what I need, I should juts go for it.
    Reagrding your remark to reorganize the info - that already works, but I wanted to try to go this route (which looks a bit better).
    Thanks to John for another alternative, I will try both and see how they work out.

  5. #5
    Join Date
    Jun 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    How about:

    <body onload="window.scrollBy(0,20000)">

    on the page inside the iframe?
    This seems to have done the trick, thanks!

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
  •