div should appear with animation
I want to show a 开发者_如何学Pythonanimation to my div control.
When page is load div should be hidden , when user click a button div should appear with some animation I want to show a sliding animation on my div control, this should happen if a button is click. I have to do it in jquery.$(document).ready(function(){
$("#btn").click(function(){
$(".divClass").slideToggle("slow");
});
});
other options are slideDown, slideUp, slideToggle,fadeIn, fadeOut, fadeTo
A complete example is as follow
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn").click(function(){
$(".divClass").slideToggle("slow");
});
});
</script>
<style type="text/css">
.divClass
{
margin:0px;
padding:5px;
text-align:center;
background:#e5eecc;
border:solid 1px #c3c3c3;
height:120px;
display:none;
}
</style>
</head>
<body>
<div class="divClass">
<p>This is a sample JQuery Animation</p>
<p>Your text or control goes here...Your text or control goes here....Your text or control goes here</p>
</div>
<input id="btn" type="button" value="Show Div" />
</body>
</html>
精彩评论