Home arrow HTML arrow 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: 4 stars4 stars4 stars4 stars4 stars / 4
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

Working the Pane for HTML Magic Edges
(Page 1 of 4 )

Introduction

I gave a lot of detailed explanation in the previous part of the series. Explanations in this and the next part of the series will be summarized where possible.

The tool for the pane in our project is a calculator.

Minimum Components on the Web Page

This is a pedagogic exercise so we shall deal only with the minimum number of components (HTML elements) necessary.

The Pane

The pane is a DIV element having another DIV element that just fits into it. This is the calculator inside the two DIV elements:


<div id="Cont" onclick="checkRemSit()" style="position:absolute; z-index:2; left=0px;top:0px; display:none">

<div id="Calc" style="left:0px;top:0px">

<input type="text" id="CI1" readonly><br />

<button type="button" class="CalcBut" id="B7">7</button><button type="button" class="CalcBut" id="B8">8</button><button type="button" class="CalcBut" id="B9">9</button><button type="button" class="CalcBut" id="BD"">/</button><button type="button" class="CalcBut" id="BMM">C</button><br />

<button type="button" class="CalcBut" id="B4">4</button><button type="button" class="CalcBut" id="B5">5</button><button type="button" class="CalcBut" id="B6">6</button><button type="button" class="CalcBut" id="BX">X</button><button type="button" class="CalcBut" id="BRM">RM</button><br />

<button type="button" class="CalcBut" id="B1">1</button><button type="button" class="CalcBut" id="B2">2</button><button type="button" class="CalcBut" id="B3">3</button><button type="button" class="CalcBut" id="BMI">-</button><button type="button" class="CalcBut" id="BMP">M+</button><br />

<button type="button" class="CalcBut" id="B0">0</button><button type="button" class="CalcBut" id="BPM">+/-</button><button type="button" class="CalcBut" id="BPOINT">.</button><button type="button" class="CalcBut" id="BP">+</button><button type="button" class="CalcBut" id="BEQ">=</button>

</div>

</div>


I will not deal with the code that does the calculation in this series. I've already written an article series on how to build a web page calculator, which is currently running on Dev Articles. You can read this article to see how the calculator functions.

Identify the DIV elements above. There is one DIV element inside another one. Inside the inner DIV element you have the elements for the calculator. The inner DIV element keeps the calculator components together. These elements consist of an Input Text element, buttons and line break elements. I will not say much about these elements – you can read the article series for more details.

The inner DIV element has the ID "Calc." In its style attribute, you have “left:0px;top:0px”. If you know that your CSS left and top values will be changing (by script) it is advisable to put their initial values in the style attribute (of the element) and not in the style sheet.

The ID of the outer DIV element is "Cont." It has an onclick event attribute. Click on it and the checkRemSit() function is called. I will explain how the function operates later.

This DIV element has a style attribute. The first property here is the position property. It has the "absolute" value. The next property is the z-index property with a value of 2. The BODY element is given a z-index value of 0. With these three properties, the pane (outer DIV) will appear in a layer above the rest of the elements, everything being equal.

Still in the style attribute, the next thing you see is “left=0px;top:0px;” That is, the left position is zero pixels and the right position is zero pixels. These values will be changing by script, so it is advisable to have them in the attribute. They are like the default values.

When the pane is coming out from or going to the left edge, the script causes the left value to be zero; when it is coming out from or entering the top edge, its top value is zero. The left and top properties should be put in the style attribute. The rest of the other properties can be put in the style sheet.

The last property we have in the style attribute is the display property. Its value is “none.” With the initial value of none, you do not see the pane. When you have to see the pane, the script will change the value to “block.” The inner DIV element will then scroll within this block.


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




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