Home arrow HTML arrow Completing the HTML Magic Edges Project
HTML

Completing the HTML Magic Edges Project


Welcome to the fifth part of a five-part series that shows you how to make HTML magic edges. These edges allow you to slide useful applications out of the sides of your web pages when a visitor slides his or her mouse over the edges. In this part of the series I explain the code for the project. We also conclude with some useful comments. Toward the end of this part, I give you a link to the complete code of the project in zip file format.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
April 06, 2009
TABLE OF CONTENTS:
  1. · Completing the HTML Magic Edges Project
  2. · Code to Shift Right and Left
  3. · The shiftRight() Function
  4. · Code to Shift Down and Up
  5. · Remarks

print this article
SEARCH DEVARTICLES

Completing the HTML Magic Edges Project
(Page 1 of 5 )

The Code and its Operation

I will give you the code as it is found in the zip file from top to bottom. I will be brief in the explanation, since we've covered the basics in the previous parts. We begin with the global variables that are used in many sections of the code. These variables are:


var edge = "";

var paneBack = true;

var leftPaneShown = false;

var topPaneShown = false;


These variables are related to some of the technical requirements we saw in the third part of the series. When the pane has scrolled from the left edge into the page, this edge variable is given the value “left.” When the pane has scrolled from the top down into the page, the variable is given the value “top.”

When the pane is still in the edge or has gone back into the edge, the paneBack variable is used to indicate this with the value of true.

Now, when you click the BODY element, the pane should scroll away. When you click the pane, since the pane is in front of the BODY element, the BODY indirectly receives a click. You do not want the pane to scroll back when the BODY is not clicked directly. The next two variables above are used for this. The first one (leftPaneShown) is for the pane from the left edge. The second one (topPaneShown) is for the pane from the top edge.

Left Edge Code

In this section we shall talk about the code for the left mimic edge.

The giveHeight() Function

Ideally the left mimic edge should be as long as the entire height of the web page. It is not a straightforward task to achieve this height. We shall allow a simple design. The DOM can allow us to get the height of the screen (without the portion of the taskbar). We shall use this height for the left mimic edge. When the page is just loaded, the giveHeight() function is called by the onload event of the BODY attribute. The function gives the height. This is the function:


function giveHeight()

{

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

}



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