animate改变样式的动画
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>动画</title>
<link rel="stylesheet" type="text/css" href="css.css" />
<script src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".btn1").click(function(){
$("#box").animate({height:"300px"});
});
$(".btn2").click(function(){
$("#box").animate({height:"100px"});
});
});
</script>
</head>
<body>
<div id="box" style="background:#98bf21;height:100px;width:100px;margin:6px;">
</div>
<button class="btn1">Animate</button>
<button class="btn2">Reset</button>
</body>
</html>
显示隐藏的动画
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>css选择器联系</title>
<link rel="stylesheet" type="text/css" href="css.css" />
<script src="http://www.w3school.com.cn/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#button").click(function () {
$("div").slideUp();
});
$("#button2").click(function(){
$("div").slideDown();
});
$("#button3").click(function () {
$("div").slideToggle();
});
$("#button4").click(function () {
$("div").hide();
});
$("#button5").click(function () {
$("div").show();
});
$("#button6").click(function () {
$("div").fadeOut();
});
$("#button7").click(function () {
$("div").fadeIn();
});
});
</script>
</head>
<body>
<div style="width:400px"> 你好,欢迎访问我的博客,如果你对
本博客有什么好的建议,可以
联系我或是给我留言哦! </div>
<button id='button'>滑动隐藏</button>
<button id='button2'>滑动显示</button>
<button id='button3'>隐藏/显示</button>
<button id='button4'>突然隐藏</button>
<button id='button5'>突然显示</button>
<button id='button6'>渐渐隐藏</button>
<button id='button7'>渐渐显示</button>
</body>
</html>