我只想在页面刷新时隐藏一些div。 这在Js_fiddle(js_fiddle_link)中工作正常,但是当我在浏览器中尝试它时,隐藏所有div后它再次出现。可能是什么原因 ? 片段:
$(function() {
$("div.show").hide("2000")
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>This is the testing for different div selection </h1>
<div class="list-group">
<li>Click here for A</li>
<li>Click here for B</li>
<li>Click here for C</li>
</div>
<div class="show">
This class holds the information aboout the A classs so those who want to join me within this group blah blah blah
</div>
<hr>
<div class="show">
This class holds the information aboout the B classs so those who want to join me within this group blah blah blah
</div>
<hr>
<div class="show">
This class holds the information aboout the C classs so those who want to join me within this group blah blah blah
</div>
<hr>
&#13;
答案 0 :(得分:0)
检查与.show
类的冲突。根据评论,原因是Bootstrap 3的.show
助手类,其中display: block !important;
规则覆盖了脚本添加的内联样式。
将.show
类更改为另一个名称修复它。