Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 15th, 2003, 10:42 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Knowing if element has scrolled out of view

Is there a means of knowing if an element has scrolled out of view?

The '<element>.scrollIntoView()' method is useful, but it would be handy to only call this if the element has actually scrolled off the top or bottom (or even sideways) off the page.
 
Old July 21st, 2003, 11:37 AM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, so is there a way of knowing what the visible offset on the screen is. That is not the offset X or top position relative to the parent element or to the top of the page, but the offset to the top of the visible screen area, to gain some idea of whether the element has gone off the top or bottom of the visible area, to know when best to use scrollIntoView().

Basically I don't want to scroll the current element to the top of the display if its in the middle - it just looks wrong. I only needed it to scroll when the element has gone out of view.








Similar Threads
Thread Thread Starter Forum Replies Last Post
traverse the whole tree without knowing the node dipsut XSLT 3 June 17th, 2011 07:49 AM
Knowing the Browser Type me_zeta HTML Code Clinic 1 November 13th, 2006 01:44 PM
How knowing it is an integer? rtr1900 Classic ASP Basics 1 October 5th, 2006 07:40 AM
Knowing File Path x_ray VB.NET 2002/2003 Basics 8 February 15th, 2006 04:12 PM
Knowing what is added/deleted in subform? nmccamy Access 2 September 21st, 2004 02:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.