課程
/前端開發
/jQuery
/jQuery基礎(四)—動畫篇
display屬性將被儲存并且需要的時候可以恢復。如果一個元素的display值為inline,然后是隱藏和顯示,這個元素將再次顯示inline ? 但是我運行的結果是? display: block;
2017-04-12
源自:jQuery基礎(四)—動畫篇 1-4
正在回答
有可能是因為你設置的屬性?width: 500px;? float: left; 所以看不出來
我跟你的運行結果相同,不過我不知道這有什么用處?
block ? ?此元素將顯示為塊級元素,此元素前后會帶有換行符。 ? ?
inline ? ?默認。此元素會被顯示為內聯元素,元素前后沒有換行符。 ? ?
<!DOCTYPE html>
<html>
<head>
? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
? ? <title></title>
? ? <style>
? ? div {
? ? ? ? width: 500px;
? ? ? ? height: 50px;
? ? ? ? padding: 5px;
? ? ? ? margin: 5px;
? ? ? ? float: left;
? ? ? ? border: 1px solid #ccc;
? ? }
? ??
? ? .left {
? ? ? ? background: #bbffaa;
? ? .right {
? ? ? ? background: yellow;
? ? ? ? display: inline;
? ? </style>
? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
? ? <h2>通過toggle切換顯示與隱藏</h2>
? ? <div class="left">顯示到隱藏</div>
? ? <div class="right">隱藏到顯示</div>
? ? <button>直接show-hide動畫</button>
? ? <button>直接hide-show動畫</button>
? ? <script type="text/javascript">
? ? $("button:first").click(function() {
? ? ? ? $(".left").toggle(3000)
? ? });
? ? </script>
? ? $("button:last").click(function() {
? ? ? ? $(".right").toggle(3000)
</body>
</html>
貼代碼出來看看
舉報
jQuery基礎教程動畫篇,講解jQuery基礎開啟動畫修煉
1 回答$.inArray()這前面怎么是個$符號呀,不怎么明白
3 回答為什么返回值是4
1 回答代碼怎么成這樣了??
2 回答這段代碼不是很了解,這里面的now與fx并沒有返回值為什么會有輸出?
1 回答這是什么意思?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-10-20
有可能是因為你設置的屬性?width: 500px;? float: left; 所以看不出來
2017-07-20
我跟你的運行結果相同,不過我不知道這有什么用處?
block ? ?此元素將顯示為塊級元素,此元素前后會帶有換行符。 ? ?
inline ? ?默認。此元素會被顯示為內聯元素,元素前后沒有換行符。 ? ?
2017-04-12
<!DOCTYPE html>
<html>
<head>
? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
? ? <title></title>
? ? <style>
? ? div {
? ? ? ? width: 500px;
? ? ? ? height: 50px;
? ? ? ? padding: 5px;
? ? ? ? margin: 5px;
? ? ? ? float: left;
? ? ? ? border: 1px solid #ccc;
? ? }
? ??
? ? .left {
? ? ? ? background: #bbffaa;
? ? }
? ??
? ? .right {
? ? ? ? background: yellow;
? ? ? ? display: inline;
? ? }
? ? </style>
? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
? ? <h2>通過toggle切換顯示與隱藏</h2>
? ? <div class="left">顯示到隱藏</div>
? ? <div class="right">隱藏到顯示</div>
? ? <button>直接show-hide動畫</button>
? ? <button>直接hide-show動畫</button>
? ? <script type="text/javascript">
? ? $("button:first").click(function() {
? ? ? ? $(".left").toggle(3000)
? ? });
? ? </script>
? ? <script type="text/javascript">
? ? $("button:last").click(function() {
? ? ? ? $(".right").toggle(3000)
? ? });
? ? </script>
</body>
</html>
2017-04-12
貼代碼出來看看