Inside Technique : Scroll Tricks II
Back in June we presented a technique for tracking the scrollbars to add a floating Top of Page link. This link stayed in the lower right and corner of the screen as the page scrolled, and disappeared when you were already at the top of the page. We authored this technique for Internet Explorer 4.0 because Netscape failed to expose any scroll events.
Last week we provided a technique that simulates the onscroll event in Netscape. This technique checks the scrollbars position on a timer. Whenever the scrollbars change position, a simulated onscroll event is created. This week we use a similar technique to position elements that stay in the upper and lower right hand corners of the screen. In this example, we create up and down scroll buttons that automatically move the page up or down one page at a time. We also add a little intelligence so only required buttons are displayed (eg., when you are at the top of the page, the up button is not displayed).
Almost every property used in this example is exposed differently by the browsers. To work around these differences and avoid writing our code twice, we add the unsupported properties to each browser and assign any new values to both properties. The property that is not supported by each browser is ignored.
On the next page, we walk through the cross-browser roadmap and show you the properties used to create this example.
© 1997-2000 InsideDHTML.com, LLC. All rights reserved.