默认情况下隐藏div,并在使用bootstrap进行点击时显示它 [英] Hide div by default and show it on click with bootstrap
本文介绍了默认情况下隐藏div,并在使用bootstrap进行点击时显示它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想显示和隐藏一个 div
,但我希望它被默认隐藏,并能够显示和隐藏它的点击。这是我所做的代码:
I want to show and hide a div
, but I want it to be hidden by default and to be able to show and hide it on click. Here is the code that I have made :
<a class="button" onclick="$('#target').toggle();">
<i class="fa fa-level-down"></i>
</a>
<div id="target">
Hello world...
</div>
推荐答案
只需添加水 style = display:none; 到
< div>
: http://jsfiddle.net/krY56/13/
jQuery:
function toggler(divId) {
$("#" + divId).toggle();
}
优先使用CSS类 .hidden
Preferred to have a CSS Class .hidden
.hidden {
display:none;
}
这篇关于默认情况下隐藏div,并在使用bootstrap进行点击时显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文