Lab #7 Simple Accordion


Lab #7 was titled "Simple Accordion". Basically, within this lab, I had created 10 questions based on a subject of choice. The subject I chose was AP Computer Science Principles. Within this lab, I had implemented my 10 questions on a webpage and then put the answers hidden in the document. Then, using jQuery I created a feature where if you hover over the question, it will reveal the corresponding answer, which would then go away if you move your mouse to another question, revealing that identical answer.  In the screenshot above, you can see that I am hovering over the question, "What is a bit?" and the answer is revealed under it which states, "A bit is a single unit of information in a computer, typically represented as a 0 or 1".

In the HTML part of the document, I had created one <dl> tag which holds all of the questions and answers. The <dt> tags nested within this tag held all of the questions while the <dd> tags held the answers. I added a class to all of the <dd> tags to add the visual effect of making it unhidden once you've hovered over the question corresponding to it. The jQuery effect consisted of mousing over an <dt> element to reveal the <dd> element while creating a slide visual to emphasize the animation.

Web designers would want to know how to do this if they want to store answers to questions on a webpage. For example, a question page with answers could be a FAQ page which users can go to in case they need help or they are asking a common question that you already have the answer for. Knowing how to do this will allow for them to use unique animations in making their webpage eye-catching and also stand out from the rest of similar questions and answer pages.

Comments

Popular posts from this blog

WBL Workshop #6 Interview Skills

CTE Expo Reflection Journal

Lab #12 Reflection