Functionality to scroll into view? (autoamtically scroll to contentsin the bottom right corner of a

C

crazychrisy54

Hi there

I am quite new to web technologies and wondered if there is anything
available so that when a large web page is opened (containing scroll
bars) you are automatically scrolled down and right to the contents
within the bottom right hand corner of the page.

Any ideas if this is possible and if so how would be very much
appreciated
 
C

crazychrisy54

Update: I have seen java script which will scroll down the page
gradually, but I just want to refresh the page and then automatically
focus the user to the bottom right corner without them having to wait.

Thanks for your help in advance!
 
D

David Mark

Hi there

I am quite new to web technologies and wondered if there is anything
available so that when a large web page is opened (containing scroll
bars) you are automatically scrolled down and right to the contents
within the bottom right hand corner of the page.

Any ideas if this is possible and if so how would be very much
appreciated

For browsers that support the window properties scrollMaxX and
scrollMaxY, as well as the scrollTo method, this is a trivial
proposition. However, IE doesn't qualify and depending on what
versions, doctypes and styles you need to support, the universal
solution can range from very simple to very complex. The scrollWidth
and scrollHeight properties of either the body or documentElement hold
the needed dimensions (presuming those elements are free of margins.)
The trick is figuring out which one. If you only need to support
IE6/7, it is simple enough to check document.compatMode (see the FAQ
entry on measuring the size of the viewport.)

Various implementations of this functionality will be future topics of
the Code Worth Recommending project.
 
C

crazychrisy54

(e-mail address removed) said the following on 12/19/2007 9:41 AM:



Put an anchor at the bottom of the page, set the hash property on the
location. Or, just link directly to the hash.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Cheers Randy, very clever!
 
C

crazychrisy54

(e-mail address removed) said the following on 12/19/2007 9:41 AM:



Put an anchor at the bottom of the page, set the hash property on the
location. Or, just link directly to the hash.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Cheers Randy, very clever!
 
C

crazychrisy54

Thanks for your advice too David
As the application needs to work across serveral browsers I am going
to try Randy's simple idea first but might well then look into
options.
Cheers
 
D

David Mark

Thanks for your advice too David
As the application needs to work across serveral browsers I am going
to try Randy's simple idea first but might well then look into
options.

Randy's suggestion should work fine if you control the content of the
page. However, if you need it to scroll exactly to the bottom (to the
pixel), you will probably need to measure and call the scrollTo
method.

Also, you should link directly to the hash. Setting the hash on load
has been known to cause issues with Safari.
 
D

David Mark

Randy's suggestion should work fine if you control the content of the
page. However, if you need it to scroll exactly to the bottom (to the
pixel), you will probably need to measure and call the scrollTo
method.

Actually, scratch that. As the browser will always try to put the
link at the very top, the hash link trick will work. Scrolling all
the way to the right might be an issue though.
 
C

crazychrisy54

Actually, scratch that. As the browser will always try to put the
link at the very top, the hash link trick will work. Scrolling all
the way to the right might be an issue though.

Cheers for all your help, using the anchor seemed to work fine. As I
print a new png image to the page each time it is refreshed, I also
know the width it is going to be so can simply print <p style="margin-
left: Image_Widthpx" id="end"/> below the image and use file.php#end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top