Home arrow HTML arrow Page 4 - Mimic Edge for HTML Magic Edges
HTML

Mimic Edge for HTML Magic Edges


In this second part of a five-part series, we will see how the inner DIV element (pane) can scroll from the top of the outer DIV element, downward. We shall also see how to make the left edge of your web page respond to events, and how the pane can scroll out of it.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
March 16, 2009
TABLE OF CONTENTS:
  1. · Mimic Edge for HTML Magic Edges
  2. · Scrolling from the web page edge
  3. · Basic Implementation of Magic Edge
  4. · Scrolling from the Left Edge

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Mimic Edge for HTML Magic Edges - Scrolling from the Left Edge
(Page 4 of 4 )

The BODY element has zero padding and zero margin. The corresponding CSS statement for this is:


body {background-color:#ff9933;padding:0px; margin:0px}


The mimic edge element is:


<div id="DL" onmouseover="doShiftRight()" style="width:1px; height:50px; background-color:#ff9933; border-width:0px; padding:0px; margin:0px; display:inline">

</div>

It has a width of 1px. It has an initial height of 50px. The actual height will be given by a function from the BODY onload event. It is advisable to give the initial height or initial width in the attribute of the element, rather than in a CSS statement in style sheet. The background color is that of the BODY element.

There is an onmouseover attribute. When the mouse is over the mimic edge, the  doShiftRight() function will be called. The value of the display property is "inline." This allows other elements to go on its right. The doShiftRight() function will shift the inner DIV element to the right. The script will no longer be in the BODY element; it will be in the HEAD element.

The outer DIV element should not have a border. Erase the following property from the CSS statement of the outer DIV element.


border:2px solid blue;


Replace what you have erased with:


border-width:0px;


The two DIV elements (inner and outer) are the elements next to the mimic edge. Remember that a DIV element has an inherent <br /> element before and after it. So the outer DIV element has to take an "inline" value for its display property. Add the following property to the CSS statement for the outer DIV element.


display:inline


Make sure the properties in any CSS statement are separated by semicolons. There is still a problem with our basic work. The "inline" value for the mimic edge implies that every space on its right is taken up by one line. So the DIV (calculator) will appear low on the line and therefore at the bottom of our present page. In order to make it appear higher up, we have to give it the CSS property “vertical-align:top.” Add the following property to the CSS statement for the outer DIV element. Make sure all properties are separated by semicolons:


vertical-align:top


The onload event for the BODY attribute is:


onload="giveHeight()"


When the web page is loaded, the following function is called:


function giveHeight()

{

document.getElementById('DL').style.height = screen.availHeight;

}


This function gives the screen height to the mimic edge.

Let us take a break here. In the next part of the series we shall continue with the shifting function.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials