Skip to content

Instantly share code, notes, and snippets.

@julsfelic
Created December 18, 2012 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julsfelic/4324662 to your computer and use it in GitHub Desktop.
Save julsfelic/4324662 to your computer and use it in GitHub Desktop.
A CodePen by JulsFelic. Simple Accordion Faq List - Just a simple accordion faq list. When you hover over the <dt> it reveals the <dd> using the small snippet of jQuery. Also added some text-shadow to give the text a stamped looked and other CSS3 goodies.
<dl>
<dt>Would you like to learn more?</dt>
<dd>Yada Yada Such and Such</dd>
<dt>Would you like to learn more?</dt>
<dd>Yada Yada Such and Such</dd>
<dt>Would you like to learn more?</dt>
<dd>Yada Yada Such and Such</dd>
<dt>Would you like to learn more?</dt>
<dd>Yada Yada Such and Such</dd>
<dt>Would you like to learn more?</dt>
<dd>Yada Yada Such and Such</dd>
</dl>
(function() {
$('dd').filter(':nth-child(n+4)').hide();
$('dl').on("mouseenter", 'dt', function() {
$(this)
.next()
.slideDown(300)
.siblings('dd')
.slideUp(300);
});
})();
body {
background: #c5c5c5;
font-family: sans-serif;
margin: 30px auto;
text-align: center;
width: 500px;
}
dl {
background: #e3e3e3;
border: 1px solid rgba(0,0,0, .2);
}
dl, dt, dd {
border-radius: 5px;
}
dt {
background: #08071c;
border-bottom: 1px solid #040412;
border-top: 1px solid #262395;
color: #137de9;
cursor: pointer;
font-size: 1.5em;
font-weight: bold;
line-height: 2em;
text-shadow: -1px -1px 0px #1169c3;
}
dt:first-child {
border-top: 0;
}
dt:last-of-type {
border-bottom: 0;
}
dd {
margin-left: 0;
padding: 1em 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment