PDA

View Full Version : document.scrollbypages() working only in Firefox/Mozilla?



Riba
06-06-2005, 11:31 AM
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!

mwinter
06-06-2005, 07:12 PM
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:


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

Mike

jscheuer1
06-06-2005, 08:05 PM
How about:

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

on the page inside the iframe?

Riba
06-07-2005, 08:27 AM
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.

Riba
06-13-2005, 07:25 PM
How about:

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

on the page inside the iframe?

This seems to have done the trick, thanks!