Home arrow HTML arrow Page 2 - Working the Pane for HTML Magic Edges
HTML

Working the Pane for HTML Magic Edges


In this part of the series, we effectively carry out a project. The project deals with a web page. The aim of the project is to allow visitors to move their mouse pointer to the edge of the web page to cause a pane with a calculator or some other useful tool to scroll into the page. The visitor can do whatever they want with the tool. Then, when they click on the BODY of the page, outside the pane, the pane scrolls back into the edge. The detailed requirements of the project are in the previous part of the series.

Author Info:
By: Chrysanthus Forcha
Rating: 3 stars3 stars3 stars3 stars3 stars / 2
March 30, 2009
TABLE OF CONTENTS:
  1. · Working the Pane for HTML Magic Edges
  2. · The Mimic Edges
  3. · The Rest of the CSS
  4. · Showing the Pane

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Working the Pane for HTML Magic Edges - The Mimic Edges
(Page 2 of 4 )

The BODY element is given a margin (all four) of 0px. It is given a padding of 0px. These values are browser dependent. To avoid complexity in layout I have given them zero pixels. The default border value for the BODY is allowed. That is also browser dependent, but for the sake of simplicity, let us allow it.

The left mimic edge is a DIV element, while the top mimic edge is an HR (horizontal rule) element. The HR element has the advantage that it fills the whole width of the screen. You do not have to give it a length value (which is the width of the client area). If you use the DIV element, you will be faced with the problem (disadvantage) of having to give it a dimension so that it covers the width of the client area; this is not easy. Remember the problem we had trying to give the left mimic edge the height of the page. A similar problem will occur if we use the DIV element for the top mimic edge. These are the elements for the two mimic edges:


<div id="DL" onmouseover="doShiftRight()" style="position:absolute; z-index:2; left:0px; top:0px; width:1px; height:50px; background-color:#ff9933; border-width:0px; padding:0px; margin:0px">

</div>

<hr id="DU" onmouseover="doShiftDown()" style="position:absolute; z-index:2; left:0px; top:0px; height:1px; background-color:#ff9933; border-width:0px; padding:0px; margin:0px">


The attribute values are many for either element. We shall briefly explain them. The ID of the left mimic edge (DIV) is "DL." When the mouse is over this element, the doShiftRight() function is called. This function prepares the page to start shifting the inner DIV to the right. The style attribute for this element has many properties.

The first one is the position property whose value is "absolute." The second one is the z-index property, whose value is 2. Remember that the BODY element has a value for the z-index property of 0. Under this condition, the left mimic edge appears in front of its surrounding elements, everything being equal.

What we have next in the style attribute is “left:0px; top:0px;” With the left and top values being zero, the mimic edge is at the left edge of the client area of the page. Next we have a width of 1px. After that we have a height of 50px. This is like a pre-initial value. The function for the onload event of the BODY element gives this property its real value (see below). Next we have a background-color, which is the same as the background-color of the BODY element. The border-width is zero, padding is zero and the margin is zero. These zero values ensure that the width of the mimic edge is just 1px and nothing more.

The HR element by default appears horizontally. If you try to make it vertical, by giving it a large height and small width, it will not work. This is the ideal element for the top mimic edge. By default it covers the whole width of the client area, just as we want. When the mouse is over it, a function called  doShiftDown() is called. This function shifts the inner DIV downward. The purposes for the rest of the values of the HR element are similar to those of the left mimic edge.


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