<!-- sample solution to index.html -->
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
<script src='script.js'></script>
<title></title>
</head>
<body>
<div class="post">
<div class="header">Header 1 (Click Me!)</div>
<div class="content">Content 1</div>
</div>
<div class="post">
<div class="header">Header 2 (Click Me!)</div>
<div class="content">Content 1</div>
</div>
<div class="post">
<div class="header">Header 3 (Click Me!)</div>
<div class="content">Content 1</div>
</div>
</body>
</html>
// sample solution to script.js
$(document).ready(function() {
$("div.header").click(function(e){
$(this).siblings(".content").animate({
//opacity: 0.25,
//left: '+=50',
height: 'toggle'
}, 250, function() {
// Animation complete.
});
});
});
/* sample solution to style.css */
* {
font-family: Calibri;
}
.post{
background-color: red;
border: solid 2px red;
}
.header{
background-color: yellow;
border: solid 1px black;
padding: 5px;
border-top-left-radius:10px;
border-top-right-radius:10px;
text-align: center;
}
.content{
background-color: orange;
border: solid black 1px;
height: 50px;
padding: 5px;
border-bottom-right-radius:10px;
border-bottom-left-radius:10px;
}
No comments:
Post a Comment