FAQ Pages with Dreamweaver CS3 and Spry

Author of this post: Tara MacKay | About Blog Authors »

Frequently asked questions pages are part of practically any client site project, but tend to be the most boring ones to design. Typically they feature a list of anchors at the top for the questions that jump to the answers farther down the long, uninteresting page. But with a little Ajax (created using a handy Spry widget in Dreamweaver), FAQ pages can look and function a lot better.

As we talked about in an earlier post, Spry widgets allow you to create dynamic features with Ajax, like tabbed or accordion-style interfaces. And accordion-style interfaces are perfect for FAQ pages…

1) Start with a new document, or the main editable area of your favorite DWT template. In the Insert bar (Window > Insert) click the Spry tab and then the Spry Accordion button.


Click once on the Spry Accordion button to get started.

This does a few things. First, you’ll see in Design View the beginnings of your accordion design. In your CSS Styles panel, you’ll see rules for the accordion that you can change later. And in Code View, you’ll see that two files are created and linked, the CSS file and a JS (JavaScript) file. When you upload your page to your server, you’ll need to make sure these files come along for the ride and remain in the proper file location.

2) Before doing any styling, get your FAQ content in, starting with your first question in the Label 1 area, your first answer (and any other content you like, like images or links) in the Content 1 area, and your next question in the Label 2 area. When those are in, click on the eye icon in the Label 2 area—this will open up the content area for your next answer.


Click the eye icon to hide the current content area and show the next one.

Chances are, your FAQ will have more than two questions, but before you get any further, test your accordion in a browser to see how it works. Clicking a question will elegantly slide open a panel with the answer without reloading the rest of the page elements (the beauty of Ajax).


Click a label in your browser to slide open its content area.

3) Time to add some more questions! Click the bright aqua “Spry Accordion: Accordion 1″ tab at the upper right of your content. This will reveal handy tools in the Properties Inspector (Window > Properties) for adding labels and content areas. Click the plus as many times as you need to add questions, and use the arrows to arrange them. Then continue on, clicking the eye icons for each label and adding your content.

Test again when all of your content is in. The accordion feature really shines when there are lots of labels and panels.

4) When you’re happy with the content, you can customize the style with the CSS rules already created for you. Adjust the size, margins, color, and other features in your CSS Styles panel, remembering to adjust the rules for open panels, closed panels, and hover features.

I like to add my type formatting here if it will vary from that of the rest of my site, and I like to change the height of the content areas to 100% (rather than the default pixel height) so the panel height conforms to the content within in. You can even eliminate the borders if you choose to avoid a boxy look. It’s all up to you, and is no different than any other CSS styling you’re used to.


Change your content height to 100% for perfect sizing with any of your FAQ answers.

Give it a final test, remember to upload the CSS and JS files along with the HTML doc, and you’re all set. Your new FAQ will look much sleeker and more streamlined, delivering answers quickly and without the usual anchors and walls of text.

7 Responses to “FAQ Pages with Dreamweaver CS3 and Spry”

  1. Dave McFarland Says:

    Great use of the Spry Accordion. An FAQ page is the perfect use for this tool. However, setting the height of the .AccordionPanelContent to 100% doesn’t resize the content areas so that each panel displays all of its contents. Instead, the 100% setting sets the height of ALL content areas to match 100% of the height of the first panel. In other words, if the first FAQ answer is only 2 lines long and you set the height of the content area to 100%, then all of the other FAQ answers will only display the first 2 lines and the user will need to use a scroll bar to read the rest of the answer. You’re better off picking a height you think matches most of your content areas, and letting the shorter answers just have extra white space at the bottom and the really long answers have a scroll bar to access all of the text.

  2. Tara MacKay Says:

    Wow, I hadn’t realized that! That’s really excellent info — it didn’t even occur to me that it would work that way. In the couple I’ve made so far, I think I just lucked out having a long enough answer in the first panel that all the others work okay. Thanks, Dave!

  3. Gordon Says:

    I am working on a site now and using the spry accordion for the first time. I found that setiing the height to -1 works to fit all the content too. I cannot, though, figure out how to set the widget so all the panels are closed when the page loads. Any help on that would be great!

    Gordon

  4. Tara MacKay Says:

    Hi Gordon,

    There’s some great info on starting with all of the panels closed (and some other good style tips I hadn’t seen before) on this page: http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample.html#AllPanelsClosed

  5. Gordon Says:

    Hi Tara,

    I found that in my search as well, but I am not much of a coder - only a dreamweaver user - so I can’t figure out where that code they provided would go!

  6. raj Says:

    aryhjhjk
    i
    h
    i
    h

  7. Rita Says:

    I set my content box height to “auto” and that took care of it. Now even when I add or delete information, it’s always fine.

Leave a Reply

 
 
 
 
 
 
 
 
 
 
 
 
 
 
image 1
Who Cares?
June 12th, 2008
Inspiration Design