Finding an Object's 3D PositionThe CSS property z-index lets you stack positioned elements in 3D (see "Stacking Objects" in Chapter 7). Using JavaScript, you can determine the z-index of individual objects on the screen using the style.zIndex property. But there's a catch: Browsers can't easily see the z-index until it is set dynamically. To get around this little problem, you have to use JavaScript to set the z-index of each object when the page first loads. In this example (Figure 14.10), clicking any of the objects will produce an alert displaying the z-index value for that element. Figure 14.10. An alert appears, displaying the layer number of the object clicked.To find the z-index of an object:
Tip
|