天天看點

jQuery各種動畫效果

<head>

<title></title>

<style type="text/css">

#d1

{

background-color:Red;

width:400px;

height:400px;

}

</style>

<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>

<script type="text/javascript">

$(function () {

//往右下方放

$("#btn1").click(function () {

$("#d1").show(3000);

});

//往左上收

$("#btn2").click(function () {

$("#d1").hide("slow");

//來回顯示和回收

$("#btn3").click(function () {

$("#d1").toggle(1000);

})

//暫停

$("#btn4").click(function () {

$("#d1").stop();

//垂直往上

$("#btn5").click(function () {

$("#d1").slideUp(3000);

//垂直向下

$("#btn6").click(function () {

$("#d1").slideDown(3000);

//模仿QQ效果

$("#d1").click(function () {

//顔色變暗,退出

$("#btn7").click(function () {

$("#d1").fadeOut(3000);

//顔色變亮,顯示

$("#btn8").click(function () {

$("#d1").fadeIn(3000);

</script>

</head>

<body>

<div id="d1">

</div>

<input id="btn1" type="button" value="show"/><br />

<input id="btn2" type="button" value="hide"/><br />

<input id="btn3" type="button" value="toggle"/><br />

<input id="btn4" type="button" value="stop"/><br />

<input id="btn5" type="button" value="slideUp"/><br />

<input id="btn6" type="button" value="slideDown"/><br />

<input id="btn7" type="button" value="fadeOut"/><br />

<input id="btn8" type="button" value="fadeIn"/><br />

</body>

</html>

本文轉自蓬萊仙羽51CTO部落格,原文連結:http://blog.51cto.com/dingxiaowei/1366606,如需轉載請自行聯系原作者

繼續閱讀