我的 about.html 中每个员工详细信息下都有各种阅读更多按钮,这些按钮将指向另一个页面中的特定部分。我有 about.html,其中显示了员工图片、摘录描述和阅读更多按钮。每个员工的完整描述可以从我输入完整描述的 bio.html 中显示为红色。
当单击 say id #bio1 的阅读更多按钮时,它将链接到 http://www.mysite/bio.html#bio2 .在这种情况下,我希望隐藏所有其他 ID(#bio2、#bio2、#bio3 等等)
HTML代码
<li>
<div class="item">
<div class="img_block wrapped_img">
<img src="img/pictures/team1.jpg" alt="Tom" />
</div>
<div class="carousel_title">
<h6>Dave</h6>
<div class="op">Chair Person</div>
</div>
<div class="carousel_desc">
<div class="exc">Saul Yarmak has the distinguished honor or repeating his role as Chairman of BXI.</div>
<div class="read_more">
<a href="http://www.bxitrade.net/bio.html#bio6">Read More</a>
</div>
</div>
</li>
最佳答案
当您点击 #bio1
时,隐藏所有具有特定类的元素并仅显示 #bio1
:
<span id='bio1' class='a'></span>
...
<span id='bio8798' class='a'></span>
$(document).on('click', '.a', function(){
$('.a').hide();
$(this).show();
})
关于javascript - 单击阅读更多特定 ID 时隐藏其他 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21257805/