Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Defining page structure for Sliding Panels

From: Dreamweaver CS3 Projects: Creating Custom Spry Widgets

Video: Defining page structure for Sliding Panels

At their heart, all Spry widgets are merely structured DIV tags controlled by JavaScript and cascading style sheets. Before we add the JavaScript and CSS to our page, we'll start by defining our widget structure. Some widgets can get fairly complicated so starting out with just the basic framework is a good way of making sure the widget will function as desired. So I've opened of the details_start.htm from the Chapter 4 directory. If you're following along with me with the exercise files, go in the Chapter 4 folder and you'll find details_start.

Defining page structure for Sliding Panels

At their heart, all Spry widgets are merely structured DIV tags controlled by JavaScript and cascading style sheets. Before we add the JavaScript and CSS to our page, we'll start by defining our widget structure. Some widgets can get fairly complicated so starting out with just the basic framework is a good way of making sure the widget will function as desired. So I've opened of the details_start.htm from the Chapter 4 directory. If you're following along with me with the exercise files, go in the Chapter 4 folder and you'll find details_start.

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 we'll do DIV and the ID for this one is going to be detail, capital S, Slide, number one. We're also to be using classes extensively with this widget. We're going to assign a class attribute of Sliding Panels. And we'll close that and hit Return and close our DIV tag. Now, you might be wondering as we create this structure where I'm getting these ID names and class names from. I'm getting them from the external JavaScript file and external CSS file. So as you're structuring and building your own widgets, pay very close attention to what ID names and what class names are being either passed into the JavaScript function or assigned dynamically through the JavaScript function so that you'll know what to make them. And actually all the tutorials, all the sample files should be very clear as to how that structures going to be set up.

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.

Dreamweaver is going to build an array of these panels in JavaScript so obviously most arrays start counting at zero so by calling the first one panel0, I'll understand which one it's talking about it if I ever having to cycle through by element ID and find out what it is. Now after that, I'm going to type in class and this one is going to be SlidingPanelsContent. Obviously, spelling and capitalization really matter here , so capital S, capital P, capital C and notice that panel's plural, content. Now I'll go ahead and put some placeholder content inside of this so I'm just going to type in 'First Panel Content' before I close the DIV tag.

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.

Show transcript

This video is part of

Image for Dreamweaver CS3 Projects: Creating Custom Spry Widgets
 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Dreamweaver CS3 Projects: Creating Custom Spry Widgets.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.