亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

jquery動畫篇1-3, #a1設置display: none !important,然后再 $("#a1").css('display', 'block !important'); $("#a1").show(3000); }); 為什么動畫不能顯示

<!DOCTYPE html>

<html>


<head>

? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

? ? <title></title>

? ? <style>

? ? .left div,

? ? .right div {

? ? ? ? width: 500px;

? ? ? ? height: 50px;

? ? ? ? padding: 5px;

? ? ? ? margin: 5px;

? ? ? ? float: left;

? ? ? ? border: 1px solid #ccc;

? ? ? ?

? ? }

? ??

? ? .left div {

? ? ? ? background: #bbffaa;

? ? }

? ??

? ? .right div {

? ? ? ? background: yellow;

? ? }

? ??

? ? #a1{display:none !important;}

? ? </style>

? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>

</head>


<body>

? ? <h2>hide-show</h2>

? ? <div class="left">

? ??

? ? ? ? <div id="a1">hide-show</div>


? ? ? ? <button>直接hide-show動畫</button>


? ? <script type="text/javascript">


? ? //點擊button

? ? //執行3秒隱藏

? ? //執行3秒顯示

? ? $("button").click(function() {

? ? ? ? $("#a1").css('display', 'block !important');

? ? ? ? $("#a1").show(3000);

? ? });


? ? </script>

</body>


</html>


正在回答

6 回答

http改成https

0 回復 有任何疑惑可以回復我~

?加了這個!important,show方法就不能把display來回切換了 ?需要你自己顯示 然后show方法提供動畫 從 width=0和height=0變會原來值,就是說 你需要自己用disoaly:block !important顯示出來 ?但是 顯示出來了 盒子寬高還是0 ,需要繼續動畫變會原來的值。

0 回復 有任何疑惑可以回復我~

這個問題挺無解的,教程方法二肯定錯的,我用attr('style','display:block !important')雖然樣式可以切換了,但沒有動畫效果了,show()加不加,動畫效果都一樣

0 回復 有任何疑惑可以回復我~

<!DOCTYPE html>
<html>

<head>
??? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
??? <title></title>
??? <style>
??? .left div,
??? .right div {
??????? width: 500px;
??????? height: 50px;
??????? padding: 5px;
??????? margin: 5px;
??????? float: left;
??????? border: 1px solid #ccc;
??? }
???
??? .left div {
??????? background: #bbffaa;
??? }
???
??? .right div {
??????? background: yellow;
??? }
??? #ai {
??????? display:none!important;
??? }
??? </style>
??? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>

<body>
??? <h2>hide-show</h2>
??? <div class="left">
???
??????? <div id="a1">hide-show</div>

??????? <button>直接hide-show動畫</button>

??? <script type="text/javascript">

??? //點擊button
??? //執行3秒隱藏
??? //執行3秒顯示
?/*?? $("button").click(function() {
??????? var flag=1;
??????? while(flag=2)
??????? {
???????????? $("#a1").hide(3000).show(3000)
??????? }
??????
??? });*/
??? $('#a1').on('mousedown mouseclick',function(){
?????? $('#a1').css('display', 'block !important');
??????? $("#a1").hide(3000).show(3000)
??? })

??? </script>
</body>

</html>


0 回復 有任何疑惑可以回復我~
#1

旋律丶秋涼

自己寫的代碼調試過沒有,什么亂七八糟的
2017-05-31 回復 有任何疑惑可以回復我~
#2

JoKer49 回復 旋律丶秋涼

有沒有教養 不會說人話?
2017-08-30 回復 有任何疑惑可以回復我~
#3

JoKer49 回復 旋律丶秋涼

什么玩意啊你 不會看了代碼再說話?
2017-08-30 回復 有任何疑惑可以回復我~
#4

旋律丶秋涼 回復 JoKer49

我說就你這水平還來寫代碼?自己寫的代碼調過了沒有就敢發出來?!important提升了display:none的優先級,再用show能顯示?就這水平還來回答問題?
2017-08-31 回復 有任何疑惑可以回復我~
查看1條回復

if ( display === true ) {
?$( "elem" ).show();
} else if ( display === false ) {
?$( "elem" ).hide();
}

0 回復 有任何疑惑可以回復我~
#1

淡水狗

代碼沒反應
2017-07-19 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

jquery動畫篇1-3, #a1設置display: none !important,然后再 $("#a1").css('display', 'block !important'); $("#a1").show(3000); }); 為什么動畫不能顯示

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號