【发布时间】:2017-12-04 14:41:21
【问题描述】:
我有一些标签在点击时会显示隐藏信息。但就像现在一样,它们会打开,但只有在单击新选项卡时才会关闭。如果可能,我能否就这两个问题获得帮助:
1-我想让标签页在你再次点击时再次关闭。
2- 我设置了链接以打开每个部分开始的页面。无论如何,我可以在单击该链接时自动打开选项卡吗?
感谢您的帮助。
已编辑以显示我现在拥有的完整代码:
$('.drop a').click(function() {
var $content = $(this).parent().next().toggle();
//HIDE THIS LINE IF YOU DO NOT WANT TO HIDE OTHER TABS ON CLICK
$('.droptab').not($content).hide();
});
.droptab {
display: none
}
<div class="child-page">
<a class="anchor" id="<?php echo $child->post_title; ?>"></a>
<h2 class="child-title drop"><a><?php echo $child->post_title; ?><span class="down-arrow"><img src="down-arrow.png" /></span></a></h2>
<div class="droptab">
<div class="description"><?php echo apply_filters('the_content', $child->post_content); ?></div>
<aside class="sidebar">
<div class="info">
<div class="more-but">
<a href="<?php the_field( 'get_more_url', $child->ID ); ?>" class="button left"><span class="caption">Get More Info</span></a>
</div>
</div>
</aside>
<div style="clear: both;"></div>
</div><!-- .droptab -->
</div>
【问题讨论】:
标签: javascript jquery show-hide