Created
February 13, 2012 15:17
-
-
Save michaelcullum/1817534 to your computer and use it in GitHub Desktop.
Basic FAQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>FAQ</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<dl> | |
<dt>Q1</dt> | |
<dd>Answer 1</dd> | |
<dt>Q2</dt> | |
<dd>Answer 2</dd> | |
<dt>Q3</dt> | |
<dd>Answer 3</dd> | |
<dt>Q4</dt> | |
<dd>Answer 4</dd> | |
<dt>Q5</dt> | |
<dd>Answer 5</dd> | |
</dl> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script> | |
(function() { | |
var dd = $('dd') | |
dd.filter(':nth-child(n+4)').addClass('hide'); | |
$('dt').on('mouseenter', function() { | |
$(this) | |
.slideDown(200) | |
.show() | |
.siblings('dd') | |
.slideUp(200); | |
}) | |
})(); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
width: 500px; | |
margin: auto; | |
text-align: center; | |
} | |
dl { | |
} | |
dd { | |
margin: 0; | |
padding: 1em 0; | |
} | |
dt { | |
cursor: pointer; | |
font-weight: bold; | |
font-size: 1.5em; | |
line-height: 2em; | |
background: #e3e3e3; | |
border-bottom: 1px solid #c5c5c5; | |
border-top: 1px solid white; | |
} | |
dt:first-child { | |
border-top: none; | |
} | |
dt:nth-last-child(2){ | |
border-bottom: none; | |
} | |
.hide { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment