当用户在打开“span3 a”后单击“内容”div 时,我无法关闭它。
它淡出并隐藏 div 片刻。如何正确定位 span3 a 以便在打开内容后关闭内容?
$(".span3").on('click', 'a', function (e) {
var href;
e.preventDefault();
href = $(this).attr("href");
$(".team-loop").find("a").removeClass("active");
$(this).addClass("active");
$('#staff_expand').fadeOut().hide();
$(".content").load(href + " #staff_expand");
});
HTML结构:
<div class="content border-bottom" > </div>
<div class="row-fluid">
<ul class="team-loop">
<?php $args = array( 'post_type' => 'team', 'posts_per_page' => 30 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<li class="span3 mobile_width"><a href="' . get_permalink() . '">';
the_content();
echo '<span class="staff_names"><span class="plus"> + </span>';
the_title();
echo '</span></a></li>';
endwhile;
?>
</ul>
</div>
然后从 url 中提取的部分是:
<div class="row-fluid" id="staff_expand">
<div class="span3">
<?php echo $content; ?>
</div>
<div class="span3">
<div><?php echo $title; ?></div>
<div><?php echo $email; ?></div>
<div><?php echo $number; ?></div>
<div><?php echo $linkedin; ?></div>
<div class="add_to_contacts"><?php echo $addcontact; ?></div>
</div>
<div class="span6">
<div class="desc"><?php echo $text1; ?></div>
<div class="desc"><?php echo $text2 ;?></div>
</div>
</div>