【发布时间】:2016-07-24 10:08:42
【问题描述】:
如何在这个 jsfiddle 示例中拥有相同的显示和隐藏按钮
https://jsfiddle.net/kodjoe/ozf2vg6n/
代码如下:
HTML
<button id="show">></button>
<button id="hide">Hide</button>
<div class="defaut"><a href="#">FR</a></div>
<div class="hide"><a href="#">EN</a></div>
<div class="hide"><a href="#">DE</a></div>
CSS
.show, .hide {float: left; display: inline-block;}
.defaut, .hide {margin: 0px; padding: 0px; width: 40px; float: left; text-align: center; }
.langue { width: 60px; }
.defaut {display: inline-block; }
.hide {display: none; }
JS
$( "#show" ).click(function() {
$( "div" ).first().show( "fast", function showNext() {
$( this ).next( "div" ).show( "fast", showNext );
$("div").show(250);
});
});
$( "#hide" ).click(function() {
$( ".hide" ).hide( 250 );
});
【问题讨论】: