
FAQ (Frequently Asked Question) pages have become commonplace on many websites for many reasons.
The main, is that they offer a way to provide support, most commonly, customer support, without having to re-iterate solutions to common problems. For larger companies, a good FAQ page can even have an effect on the amount of support staff that are needed to be hired, yet browsing the internet, I continually find FAQ pages to be neglected, and a navigational nightmare. Similarly, Google for some articles on FAQ page design, and you’ll find near to nothing that’s helpful.
While designing a recent project in Photoshop (a software sales theme), I decided the support area was something I wanted to get right, with the focus falling heavily on the FAQ page. I wanted to get a feel for how I wanted it to work, and so I got thinking; What is it that the end-user wants when they arrive. I came up with these thoughts,
- Ease of reading – the hierarchy of the text needs to be distinct
- Organization – questions should be split into categories
- Navigation – finding their way to the information they want should be made easy, and quick
With these three points in mind, I came up with a tidy, and importantly clean FAQ page concept, the demo of which can be found below. I’m going to talk you through how it was made, and teach you how to build it yourself.
Click this link for a demo of the FAQ page we are going to make. You can also download the source code
here.
Tutorial Requirements
This tutorial assumes you are fairly comfortable using the following languages
Step 1 – Structuring our Html
Our html is split into two main sections. Within our wrapper, we have a primary column, and a sidebar column.
2 | <div id="primary></div> |
3 | <div id="sidebar"></div> |
The primary content column is where we are going to split our questions into simple categories. Each category will have a title, a list of the questions with links, and then the questions split up using a definition list. The markup we are looking for goes like this. (This shows a category with two columns)
01 | <h3 id="1">Lacus pulvinar |
02 | <ul class="section_menu"> |
04 | <li><a href="#1_1">Lectus massa adipiscing, mattis. Turpis integer massa.</a></li> |
06 | <li><a href="#1_2">Integer enim montes mauris, arcu est.</a></li> |
09 | <dt id="1_1">Lectus massa adipiscing, mattis. Turpis integer massa.</dt> |
10 | <dd>Ultricies in mus, magna rhoncus augue, nec magnis facilisis integer ut pellentesque aliquam sit! Enim odio, porta augue, sed turpis dolor ultrices porttitor arcu massa cum elementum hac in vel, magna magnis, enim scelerisque? Amet aliquam, magna dis porta platea. Cras aliquet. Arcu mid eros aenean parturient cras ac egestas tempor? Lundium parturient dapibus, ridiculus ridiculus dapibus! Quis eros amet.</dd> |
11 | <dt id="1_2">Integer enim montes mauris, arcu est.</dt> |
12 | <dd>Et ridiculus vut dis vel integer pid? Adipiscing nec tristique dictumst tristique duis rhoncus sed, scelerisque. Porta, diam augue vel augue porta enim. Et! Tristique montes. Auctor! Pid tristique purus montes. Quis? Sit, enim. Egestas! Tristique amet mattis adipiscing, proin elit adipiscing integer! Enim, odio. Etiam ac, nunc est purus turpis. Nunc! Pid cras scelerisque mid habitasse. Cum magnis.</dd> |
It is important that you match up the navigational links for each category of questions with their ID’s. Notice that the first question in this category has an id of “1_1″, and the link the first question has a href of that id. This is important in solving our navigational problems for the user. Similarly, notice that the category title has a numerical id, to show that this is the first category. These id’s need not be numerical, they can be whatever you want, as long as they are unique to the category / question.
Moving onto the sidebar, this is where navigating the bigger picture comes into place. We’ve linked up out category questions, but how to users navigate to the categories themselves? Through the sidebar is how.
Within the sidebar, we are going to include a header, and another navigational menu linking to our categories. You can build upon, this of course, and add whatever you want to your sidebar, possibly a quick contact form, or support contact details.
02 | <h3>Select Category</h3> |
03 | <ul class="section_menu"> |
05 | <li><a href="#1">Lectus facilisis vel</a></li> |
07 | <li><a href="#2">Vut magna</a></li> |
09 | <li><a href="#3">Lacus pulvinar</a></li> |
Step 2 – Creating our layout and typography with Css
First off, we want our FAQ page to look universal in all browsers, so as always we will apply a css reset. We also want the FAQ page to be easily readable, and look stunning yet simple. For this I’ve used a modified version of the text.css that comes with 960.gs, instead using Myriad Pro, and Helvetica as our fonts. Since this section of css is large, and very basic,
you can copy and paste it from here.
Starting off with our basic styles, we are going to create our layout columns, and center our page in the middle of our window.
11 | margin: 20px 40px 0 0; |
You’ll notice that we have absolutely positioned our sidebar rather than float it to the left of our primary content column. This is important for something special we are going to do with our sidebar later on.
Now it’s time to start adding some subtle styling to our page content to bring it up to standard and make viewing it extra eye pleasing. We’ll start off with two basic styles on our h3 and a tags.
14 | text-decoration:underline; |
You’ll have noticed some of the class names I dropped into the html when we created it. These include section_menu and faq. They’re used to style our navigational menus (sidebar included), and our questions themselves.
23 | border-bottom:1px solid #cccccc; |
Step 4 – Creating a static sidebar with Jquery
Now we are going to start using Jquery to improve the usability of our page. Currently it looks nice, and works well for a page without any javascript, but we can make it so much better! Start by including jquery in the had of your page. We are going to load it directly from google.
Secondly we are going to add slightly the html of our sidebar. Add another div wrapping all the content of your sidebar. In our case, I’m going to give it an id of “sidebar_content”.
2 | <div id="sidebar_content"> |
We also need a bit extra css, and css for our sidebar for when it becomes fixed.
10 | #sidebar_content.fixed { |
You may not understand the fixed class yet, but the following Jquery will help clear that up for you. Create a script tag in the head of your document, below, the Jquery we are loading from Google, and insert this code.
01 | $(document).ready(function () { |
02 | var sidebar = $('#sidebar_content'); |
03 | var top = sidebar.offset().top - parseFloat(sidebar.css('marginTop')); |
04 | $(window).scroll(function (event) { |
05 | var ypos = $(this).scrollTop(); |
07 | sidebar.addClass('fixed'); |
10 | sidebar.removeClass('fixed'); |
This may look daunting if you’ve never touched Jquery before, but don’t worry, we’ll step through it line by line. We start off with the Jquery basic of when the document is ready, run this code. The create two variables.
1 | var sidebar = $('#sidebar_content'); |
2 | var top = sidebar.offset().top - parseFloat(sidebar.css('marginTop')); |
Our first variable, “sidebar”, assigns the variable sidebar, with the selector pointing to our inner sidebar div. We called it “sidebar_inner”, but you may have called it something different.
Our second variable, top, calculates the distance of the sidebar from the top the top of the page, minus any top margin that we have applied.
1 | $(window).scroll(function (event) { |
2 | var ypos = $(this).scrollTop(); |
4 | sidebar.addClass('fixed'); |
7 | sidebar.removeClass('fixed'); |
This snippet of code starts off by saying, if the window is scrolled, carry out this code. I starts again by creating another variable by calculating how far from the top of the page we are, and assigning it to the variable “ypos” (position on the y-axis).
We then enter an if statement, that says: If the distance to scroll to the top is greater than the distance that the sidebar is from the top, give it to class of fixed. If not, don’t give it the class of fixed. This is where the fixed class we created earlier on comes into play. Easy huh? =)
Step 5 – Making a smooth page scrolling effect
So we have a lovely fixed sidebar as we scroll, without the traditional glitchy jumping that used to be commonplace with fixed sidebars, but out internal page linking still jumps directly to the destination, and while this is good, it isn’t very eye pleasing, so we are going to add an animated page scroll. Since the jquery to achieve this is too complex for us to hand write, we are going to use a plugin called localScroll, and another called ScrollTo for our animation.
Download them both from here, and include them in the head of your document again, this time between our Google hosted Jquery, and our custom written Jquery.
1 | <script src="jquery.scrollTo-1.4.2-min.js"></script> |
2 | <script src="jquery.localscroll-1.2.7-min.js"></script> |
The implementation of this is stunningly easy. Simply add to our custom Jquery this one line of code.
Note : Make sure you place this line of code within the jquery wrapper,
1 | $(document).ready(function () { |
And there you have it! A fantastically usable, and simply beautiful FAQ page that means the user can easily navigate between categories and questions, without having to spend ages scrolling through search pages, and loading page after page for different categories, or even clicking to open a single question.
Further Discussion
Have some thoughts on the usability of this page? Give them to me, I’d love to hear them. This is as much a proof of concept as it is a tutorial introducing you to basic html, css, Jquery, and plugins, but I’m sure there will be people out there who will feel a perfect FAQ page is something else. If so, what would you do?
Tidak ada komentar:
Posting Komentar