子类别(sub_categories)和子类别3(sub_categories_three)。现在我想在Sub_categories id的基础上显示关于jQuery鼠标悬停效果的sub_categories_three。
HTML代码
<?php $id=$row['id'];
$sub_cat=$sub_category->allSubCategory($id);
while ($row=mysqli_fetch_assoc($sub_cat)) {
?>
<div class="vc_row row wpb_row vc_row-fluid">
<div class="wpb_column vc_column_container vc_col-sm-6 col-sm-6">
<div class="vc_column-inner ">
<div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element ">
<div class="wpb_wrapper">
<ul>
<?php echo "<li sc='sub_cats' value=".$row['id']."><a href=".$row['id'].">".$row['sc_name']."</a></li>";?>
<!-- End Sub Category Code Here -->
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="wpb_column vc_column_container vc_col-sm-6 col-sm-6 sub_cats_three">
<div class="vc_column-inner ">
<div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element ">
<div class="wpb_wrapper">
<ul>
<?php
$ids=$row['id'];
$sub_cat_three=$sub_category_three->allSubCategorythree($ids);
while ($row=mysqli_fetch_assoc($sub_cat_three)) {
echo "<li sct='sct' sc_id=".$ids."><a href=".$row['id'].">".$row['sct_name']."</a></li>";
}
?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
这是Jquery代码
$('[sct="sct"]').hide();
$('[sc="sub_cats"]').bind('mouseover', function() {
if($(this).val() != '') {
$('[sct="sct"]').hide();
console.log($('[sct="sct"] [sc_id="'+$(this).val()+'"]'));
} else {
$('[sct="sct"]').hide();
}
});