Home arrow HTML arrow Scrolling Functions for HTML Magic Edges
HTML

Scrolling Functions for HTML Magic Edges


Welcome to the third part of a five-part series that explains how to create magic edges -- edges of web pages from which items can be scrolled -- using HTML. In this part, we continue with the basics of scrolling from the left edge. We shall complete the basics in this part, and then we shall begin the project.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
March 23, 2009
TABLE OF CONTENTS:
  1. · Scrolling Functions for HTML Magic Edges
  2. · The shiftRight() Function
  3. · Removing the Pane
  4. · The Project

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Scrolling Functions for HTML Magic Edges
(Page 1 of 4 )

Basic Function for Scrolling from the Left

When the mouse pointer goes over the left edge, the doShiftRight() function is called. The function has two associated variables. This is the function with the variables:


var x; //x coordinate

var TR; //return value for setInterval() function - moving right


function doShiftRight()

{

x = document.getElementById('Calc').style.left;

x = parseInt(x);


TR = self.setInterval("shiftRight()",10);

}


Keep in mind that the pixel is the smallest recognizable component on the web page. The web page is filled with pixels arranged in rows and columns. The entire image you see on the screen is a result of the pixels having different colors.

The x variable above is for a column of pixels in the outer DIV element. Remember that the inner DIV element just fits into the outer DIV element. So this variable is actually used to change the horizontal position of the inner DIV. The next variable, TR, is for the return ID for the setInterval() method inside the function above.

The first line in the function copies the CSS left position value of the inner DIV element to the x variable. This left value at the start is –205px. The next line makes sure it is an integer. The third line calls a function named shiftRight() through the DOM’s setInterval() function every 10ms.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials