|
||
| Inside Technique : Circular Layout Manager Demonstrates how to separate the presentation and layout from the contents of your document. This page uses simple algorithm to define a custom layout for standard HTML. This demonstration requires Internet Explorer 4.0. With Internet Explorer 4.0, anchors would automatically layout into a circle. DescriptionThis example demonstrates how you can separate custom layout behavior from the content. In this example, all the contents are defined within DIV elements. These DIV elements by themselves render as standard HTML. Once the page is loaded, a function is called that takes the elements and moves them into their appropriate place on the screen. In this example, the contents are layed out in a circle or an ellipse depending upon the specified dimensions. To use this function, the first step is to include a style sheet on the page. The stylesheet defines a fixed size for the element with the
ID of circle. Within this element all the contained DIV's will be layed out. The style sheet is defined as follows:
The stylesheet also defines that each DIV within the CIRCLE element is defined with absolute positioning. This allows the function to later move the element to its correct location.
Below is the HTML containing the content to layout:
Once the page is finished loading, a function is called that repositions the elements into a circle or an ellipse.
The function, layoutCircle, is called and takes 3 arguments, the width and height of the circle, and an
array of elements that need to be positioned. The function is called for this page as follows:
Code
function layoutCircle(w, h, circleList) {
var xradius = w/2
var yradius = h/2
for (var i = 0; i
© 1997-2000 InsideDHTML.com, LLC. All rights reserved. |