国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jQuery 回調(diào)方法

jQuery 動(dòng)畫(huà)的問(wèn)題

許多 jQuery 函數(shù)涉及動(dòng)畫(huà)。這些函數(shù)也許會(huì)將?speed?或?duration?作為可選參數(shù)。

例子:$("p").hide("slow")

speed?或?duration?參數(shù)可以設(shè)置許多不同的值,比如 "slow", "fast", "normal" 或毫秒。

實(shí)例

以下實(shí)例在隱藏效果完全實(shí)現(xiàn)后回調(diào)函數(shù):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide("slow",function(){
      alert("段落現(xiàn)在被隱藏了");
    });
  });
});
</script>
</head>
<body>
<button>隱藏</button>
<p>點(diǎn)擊“隱藏”按鈕我就會(huì)消失</p>
</body>
</html>

以下實(shí)例沒(méi)有回調(diào)函數(shù),警告框會(huì)在隱藏效果完成前彈出:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide(1000);
    alert("現(xiàn)在段落被隱藏了");
  });
});
</script>
</head>
<body>
<button>隱藏</button>
<p>這是一個(gè)段落</p>
</body>
</html>


繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <style type="text/css"> body{font-family: "微軟雅黑";width: 420px; margin: 0 auto; text-align: center;} .box{ width: 200px; height: 200px; background: green; border: 1px solid #e6e6e6; margintop: 50px; line-height: 200px; position: absolute; } button{ border: none; background: green; width: 100px; height: 50px; line-height: 50px; color: #fff; font-size: 16px; margin-top: 50px; } </style> </head> <body> <button>點(diǎn)擊開(kāi)始動(dòng)畫(huà)</button> <div class="box" ></div> <script> $(document).ready(function(){ $("button").click(function(){ var div=$(".box"); div.animate({height:'200px',opacity:'0.4'},"slow"); div.animate({width:'200px',opacity:'0.8'},"slow"); div.animate({height:'100px',opacity:'0.4'},"slow"); div.animate({width:'100px',opacity:'0.8'},"slow"); div.animate({right:'100px',opacity:'0.8'},"slow"); div.animate({bottom:'100px',opacity:'0.8'},"slow"); div.animate({left:'100px',opacity:'0.8'},"slow"); div.animate({top:'100px',opacity:'0.8'},"slow",function(){ alert("The paragraph is over"); }); }); }); </script> <script> $(document).ready(function(){ $("button").click(function(){ var div=$(".box"); div.animate({height:'300px',opacity:'0.4'},"slow"); div.animate({width:'300px',opacity:'0.8'},"slow"); div.animate({height:'100px',opacity:'0.4'},"slow"); div.animate({width:'100px',opacity:'0.8'},"slow",function(){ alert("The paragraph is over");      }); }); }); }); </script> </body> </html>
提交重置代碼