complete是必須的嗎?
<!DOCTYPE html>
<html>
<head>
? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
? ? <title></title>
? ? <style>
? ? .left div,
? ? .right div {
? ? ? ? width: 100%;
? ? ? ? height: 50px;
? ? ? ? padding: 5px;
? ? ? ? margin: 5px;
? ? ? ? float: left;
? ? ? ? border: 1px solid #ccc;
? ? }
? ??
? ? .left div {
? ? ? ? background: #bbffaa;
? ? }
? ??
? ? .right div {
? ? ? ? background: yellow;
? ? }
? ? .dd{
? ? ? ? display: block;
? ? }
? ? </style>
? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
? ? <h2>hide</h2>
? ? <div class="left">
? ? ? ? <h4>測試一</h4>
? ? ? ? <div id="a1">hide操作</div>
? ? ? ? <button>直接hide</button>
? ? ? ? <script type="text/javascript">
? ? ? ? //點擊buttom1 直接隱藏
? ? ? ? $("button:first").click(function() {
? ? ? ? ? ? $("#a1").hide()
? ? ? ? });
? ? ? ? </script>
? ? ? ? <h4>測試一</h4>
? ? ? ? <div id="a2">hide動畫操作</div>
? ? ? ? <button class="dd">hide帶動畫</button>
? ? ? ? <script type="text/javascript">
? ? ? ? //點擊buttom2 執行動畫隱藏
? ? ? ? $('button:last').click(function(){
? ? ? ? ? ? $('#a2').hide({
? ? ? ? ? ? ? ? duration:3000,
? ? ? ? ? ? ? ?com:function(){
? ? ? ? ? ? ? ? ? ? $('#a2').css('display','block')
? ? ? ? ? ? ? ? }
? ? ? ? ? ? })
? ? ? ? })
? ? ? ? </script>
? ? </div>
</body>
</html>
為什么我把complete改成com就顯示不了display:block,但是改成complete就可以,請問complete是必須的嗎
2017-01-22
必須寫complete,就像duration一樣,也可以完全不寫,如下: