Join James Williamson for an in-depth discussion in this video Defining page structure for Sliding Panels, part of Dreamweaver CS3 Projects: Creating Custom Spry Widgets.
So a lot of what we'll be doing is hand coding. So I'm going to switch over to Code View, and I can collapse my panels so that I can see my code a little bit better, and I'm going to scroll down to line 45. Now on line 45, we can see that we have a DIV tag called panelContainer. This is going to hold our Spry widget and the reason that we are going to encase this in another DIV tag is so that we can give it a little additional styling. So I'm going to hit Return and go down to line 46; it's going to be all on its own line. And I'm just going to create a new DIV tag.
So now we have a DIV tag that's going to surround all or our Sliding Panels. I'll go ahead and we'll just create another DIV tag to hold the Sliding Panel's content group. So we'll do another DIV tag inside of our detailSlide1 and it's only going to have a class attribure and it's class attribute is going to be capital S, Sliding, capital P, Panels, capital C, Content, capital G, Group. So that's a long one. SlidingPanelsContentGroup. Most of the names make sense if you think about them. If you really pay attention to what you're naming everything, it should make a good bit of sense. So we're going to go ahead and close that DIV tag as well.
So right now our structure has an outer DIV tag called detailSlide1, and we have an inner DIV tag with a class attribute of SlidingPanelsContentGroup. After we're done with that, we need to insert a DIV tag for each panel of content and in our exercise, our widget will have four panels for the four products we're going to be highlighting. We need to create four of these. So I'm going to create a DIV tag inside my SlidingPanelsContentGroup and I'm giving it an ID of panel0. That ID is one that I came up with. That's not required for our Sliding Panels widget.
The same structure holds for all these so I'm just going to copy this code and paste it. The next thing I have to do is change the ID from panel0 to panel1. The class remains the same. So that's one reason why we're using a class here; we can apply the class over and over and over again, no matter how many panels we have. I'll change the placeholder text to Second Panel Content. Just go ahead and do that a couple more times, changing it to panel2 and then Third Panel Content, and then finally changing it to panel3 and then Fourth Panel Content.
Now the one thing that might trip you up here a little bit is the fact that we're starting our IDs at zero, but then we're saying first, second, third and fourth panel content. So keep in mind that panel3 will actually hold the fourth panel content. Alright I'm going to go and save the file and I'll switch back over to Design View. I can clearly see the structure, so just below my thumbnails, I have a DIV tag that holds the first panel, second, third and fourth panel content. We now have our clean, structured markup necessary to create our Sliding Panels. Before adding the necessary scripting, we'll go ahead and replace our placeholder content with the actual content of the panels.
This process is simplified considerably by having the structure already in place.
- Examining the Spry framework
- Finding information on customizing Spry assets
- Defining page structure
- Modifying presentation through CSS