• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 8. Using Libraries > Modifying a Library Item Containing Behaviors

Modifying a Library Item Containing Behaviors

Library items that contain behaviors require a more complex editing process than items that do not contain behaviors. The options on the Behaviors panel are grayed out while you are editing a library item so you can't modify a behavior from the Library panel. You must first detach the item from a page in order to make your changes. You can then delete the original item and create a new one from the modified elements. The following steps demonstrate how to edit these kinds of library items.

In technology.html, click the history image to select the navigation library item at the top of the document.

You created a library item from this table in the previous exercise. The whole library item becomes selected.

Make a note of the name of the library item; then click Detach from Original in the Property inspector. Dreamweaver will warn you that this item will no longer be able to be updated if you detach it; click OK to continue.

The name of this library item is “navigation.” It is important to remember the exact name so that when you make this table a library item again, any links to the library item in the rest of your site will remain correct. Now that you have detached the item, you can edit the rollover.

Select the technology image and choose Window > Behaviors to open the Behaviors panel.

This rollover uses the wrong graphic when it swaps. In the following steps, you'll change the graphic from a lens image to a lighthouse image.

Double-click the existing Swap Image action in the list of attached behaviors on the Behaviors panel.


Make sure you double-click the Swap Image action, not the Swap Image Restore action.

The Swap Image dialog box opens.

In the Swap Image dialog box, click Browse and find nav_technology_on.gif. Choose the image by clicking Open (Macintosh) or Select (Windows). Click OK to close the Swap Image dialog box.

The Swap Image dialog box closes, and the rollover now uses the correct image.

Select the original library item, navigation, in the Library panel. Then click the Delete icon at the bottom of the panel. Click Yes when that dialog box asks whether you are sure you want to delete the library item.

The original library item is now deleted. Because it is not possible to edit behaviors directly in a library element, you have to delete the original item and replace it with a corrected version.

Click the history navigation graphic near the top of the page, underneath the main “Lights of the Coast” title. Again, use the Tag Selector at the bottom of the document window to select the table by clicking the < table > tag that is closest to the history image.

You will use this table to replace the original library item.

Click the new Library Item icon at the bottom of the Library panel and name the library item exactly as the original was named: navigation.

The modified elements are now stored in the Library folder.

Choose Modify > Library > Update Pages. In the Look In drop-down menu, verify that Entire Site is chosen. In Update check boxes, verify that the Library Items box is checked and the Templates box is unchecked. Check the Show Log box and click Start.

The pages in the rest of the site that once used the original navigation library item are now updated with the new version.

Click Close to close the dialog box. Save the technology.html document and test your pages in the browser.

Both technology.html and culture.html will now use the correct rollover image.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint