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

Styling Spry accordion panels

From: Layouts with CSS in Dreamweaver

Video: Styling Spry accordion panels

When I first heard the term accordion panels I thought, what, they play music? Sadly, my fantasy did not come true. Instead accordion panels are a wonderful addition to the designer's layout palette that can hold a great deal of content in a concentrated space. Let me show you one example of highly stylized accordion panels. That's on this page here in the Our Services area. If you click on any of the titles each of the panels fly up with a little animation and expose the content.

Styling Spry accordion panels

When I first heard the term accordion panels I thought, what, they play music? Sadly, my fantasy did not come true. Instead accordion panels are a wonderful addition to the designer's layout palette that can hold a great deal of content in a concentrated space. Let me show you one example of highly stylized accordion panels. That's on this page here in the Our Services area. If you click on any of the titles each of the panels fly up with a little animation and expose the content.

When you hover over labels they change its background color and it becomes bold. These particular accordion panels are based on Adobe's Spry framework and in this video I'll show you how I styled them to fit perfectly in my site as an example of how you can integrate accordion panels into yours. So let me close out this index.htm and show you this index.htm and if you scroll down a bit you'll notice that there are no accordion panels yet installed. We're going to do that right away. So if you place your cursor right after Our Services and then select h2 we're going to move the cursor right after the h2.

Just press the Right Arrow key once so that you'll be still within the content div, but after the accordion panels. To verify this you can open up Split view if you want and there you can see that's where the cursor is right after the h2 statement. Let's go ahead go back to Design view and open up the Insert panel. We want to go to the Layout category and scroll down a little bit until you see Spry Accordion.

Click that once and this will insert the default arrangement for the spry accordion which sets up two accordion panels. I'm going to open up the Properties panel for a little bit. Scroll down here so we can still see our accordion panel. Now whenever the Spry Accordion tab is selected up here the bright Blue one that you see, the Property Inspector will show all the properties available to you for the Accordion panel. Now one of the things we can do is add additional panels, and if you'll recall I had a good number of them available in the completed example 06 and all.

So let's go ahead and hit the plus button a number of times. So there is Label 3, 4, 5, and 6. In this example I'm not going to change any of the labels or bring in any content we're just going to concentrate right on the styling. Now I'm going to Save the page and watch what happens. Dreamweaver will bring up a dialog box to let you know that it has some dependent files that it needs to bring into the site and it's going to bring them in and put them in the site root in a folder called SpryAssets.

So I'll click OK and I'm going to open up the Files panel a little bit just to show it to you. Now let me close the CSS Style to give us some more room and there you can see in the root of my folder is the SpryAssets folder and within that is SpryAccordion.css and SpryAccordion.js.

Let's prepare for the next couple of steps by opening up the CSS Styles panel completely. Now depending on the level of customization that you have to do to adapt your spry widgets to your site you can either go in and make modifications to the SpryAccordion.css page that we see here and that's listed in the CSS Styles panel in the All mode, or you can create your own spry CSS file. When there are a lot of changes to be made I like to pick the secondary route, because it allows me to keep my styles completely separate if I want to use the default setup in another location on the site.

So to do that what I'm going to do is go into SpryAccordion.css choose Command+A on the Mac, or Ctrl+A on the PC in order to select everything and then copy it with a Command+C or Ctrl+C. And now I'm going to create a new CSS file by going to File>New and choose Blank Page and the Page Type this time will be CSS and I'll just click Create.

And once that opens up I'll go ahead and use Command+V to paste in everything that I copied and let's Save this as a new CSS file and this time I'm going to keep it in the Chapter 4>04_04 folder. There is a styles folder there and I'm going to call it mySpryAcc for accordion. Save that.

Now the next step is to go to the source code for our page and we'll link in our newly created files. So if you go down to the bottom of the CSS Styles panel the first button that you see there in the group on the right is Attach Style Sheet. It looks like a couple of pieces of chain for linking. Then once the Attach External Style Sheet dialog box opens click Browse and you want to navigate to the Chapter 4>04_04 folder find the styles folder and then select mySpryAcc.css.

Click Choose and then click OK. Now let me go to Code, because it's important that this particular stylesheet is linked after the one that Dreamweaver automatically inserted. So I'm going to go up to where the body tag starts and the head stops and the first thing that we see here is the script tag linking to the JavaScript file for SpryAccordion followed by the CSS file for SpryAccordion and then finally mySpryAcc.css which at the moment is an exact duplicate of the SpryAccordion.css.

Perfect! So I'm going to go ahead and save this configuration and now let's go back out to Design view and start making some changes. So we can bring in the default accordion panel into something that works well with this site. In All we're going to change eight out of the nine rules that are available to us in the Spry Accordion panel. I'll show you exactly what changes to make in the next movie.

Show transcript

This video is part of

Image for Layouts with CSS in Dreamweaver
Layouts with CSS in Dreamweaver

30 video lessons · 21435 viewers

Joseph Lowery
Author

 

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 Layouts with CSS in Dreamweaver.

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 preferencesfrom 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.