Chapter 43. Positioned Objects

IN THIS CHAPTER

  • Layer concepts

  • Moving, hiding, and showing content

  • Layering objects in the modern DOM

This chapter tackles positioned objects and layers, briefly acknowledging the early contribution that Netscape Navigator 4 made to the subject. Having survived a turbulent time of severe browser compatibility problems in this area, modern browsers have now adopted W3C standards for positioned content. Since current browsers explicitly do not provide backward compatibility with the original NN4 scripted layerelement object, this chapter won't do so either.

The modern solution to scripted layering is through Cascading Style Sheets (CSS) and the scripting thereof. This chapter therefore focuses on how to apply CSS and modern DOM techniques to manage positioned elements in modern browsers. When reading and working through this chapter, keep in mind something we pointed out in Chapter 38, "Style Sheet and Style Objects": although defining styles in style sheets is a best practice, if an element object presents a scriptable property that reflects an attribute for that element's tag, the first time a script tries to read that property, a value will be associated with that property only if the attribute is explicitly assigned in the HTML code. You'll notice in this chapter's listings, therefore, that we have put the styles we are not manipulating into a style sheet, and the ones we are into style attributes.

What Is a Layer?

Terminology in the area of positioned ...

Get JavaScript® Bible, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.