For a more unique take, you??™ll need to get your hands dirty with your
own code.
USING LINKS AND CREATING NAVIGATION
189
5
Note that some may consider the behavior of Lightbox2 at odds with user expectation,
because the browser back button returns you to the previous page you visited, rather than
closing the lightbox. In my opinion, this is logical??”after all, Lightbox2 is internal page content,
not a separate page. However, if you??™d like to override the default behavior and have
the back button on the browser close the lightbox, instructions are available from
www.cloversignsblog.com/2007/06/fixing-the-back-button-in-lightbox/.
Collapsible page content
The DOM enables you to access and dynamically control various aspects of a web page,
and this allows you to use a nifty little trick to toggle the visibility of divs. This has numerous
uses, from providing a method of hiding ???spoiler??? content unless someone wants to
see it, to various navigation-oriented uses, which will be more fully explored later in the
chapter.
Required files The collapsible-div-starting-point folder from the chapter 5
folder.
What you??™ll learn How to create a collapsible div.
Completed files The collapsible-div-completed folder from the chapter 5
folder.
1. Examine the script. Open collapsible-div.js. The code enables you to target any
div with a unique id value. Each time the script is run, it determines whether the
display value of the div is set to block (which makes it visible).
Pages:
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283