[Javascript] innerwidth
Andrew Dunn
andrew at d2k.com.au
Thu May 23 21:57:32 CDT 2002
I have tried this code but it says "innerHeight is undefined", I forgot to
mention that this window is a frame would this make any difference?
Thanks.
-----Original Message-----
From: J. Lester Novros II [mailto:lester at denhaag.org]
Sent: Friday, 24 May 2002 12:05 PM
To: javascript at LaTech.edu
Subject: Re: [Javascript] innerwidth
Dear Andrew,
On 05/24/2002 03:09 AM, Andrew Dunn wrote:
> Hi,
> I have a loop as follows, which scrolls to the end of the page slowly:
>
> function startScrolling ()
> {
> window.scrollBy(1,0);
This statement would scroll the page horizontally; 'scrollBy(0, 1);' would
scroll vertically.
> When the browser gets to the end of the page I want it to go back to
> the beginning, but I can't figure out how to do it. I thought about
> using innerWidth and a counter (i) but I can't get the innerWidth to
> work: here is a link to the page:
Try doing it this way:
function startScrolling()
{
window.scrollBy(0, 1);
if ((innerHeight + pageYOffset) < document.body.offsetHeight)
setTimeout ('startScrolling()', 60);
else
window.scrollTo(0, 0);
}
'pageYOffset' returns the amount that the page has been scrolled vertically,
i.e. the distance between the document top and the top of the canvas a.k.a.
client area; 'innerHeight' is the height of the canvas.
Hope this helps.
l8R lES
--
Since 1998, a federal judge ordered a breakup, an appeals court threw out
that order, and a new judge took responsibility; yet even with 2 courts
finding that
m$ violated the Antitrust Act, no remedy has been put into effect. cNet
News
http://open.denhaag.nu
http://www.denhaag.org
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list