我有几个div包的div。每个都有几个类内容的div。如何使用jquery和css自动切换显示的内容?
<div class="wrap">
<div class="content is-showing"></div>
<div class="content is-not-showing"></div>
...
</div>
<div class="wrap">
<div class="content is-not-showing"></div>
<div class="content is-showing"></div>
...
</div>
...
答案 0 :(得分:0)
我想你想要这样的东西?:
CSS:
.is-not-showing {
display: none;
}
JS:
$( ".wrap > .content" ).toggleClass( "is-not-showing" );
答案 1 :(得分:0)
简单地说:
$('.is-not-showing').hide()
function switch() {
$('.is-not-showing, .is-showing').toggle();
}