您可以根据活动的 li使用append
to ,例如:span/.vc_tta-title-text
vc_active
$('.vc_active .vc_tta-title-text').append('<hr class="break-sec">');
//OR
$('.vc_active span').append('<hr class="break-sec">');
添加点击事件以使其hr
动态附加:
$('body').on('click', '.vc_tta-tab', function(){
$('.vc_tta-title-text hr').remove(); //remove 'hr' from previous active tab
$('.vc_active span').append('<hr class="break-sec">'); //Add 'hr' to the new active tab
})
希望这可以帮助。
$('.vc_active .vc_tta-title-text').append('<hr class="break-sec">');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul>
<li class="vc_tta-tab" data-vc-tab="">
<a href="#1485520583544" data-vc-tabs="" data-vc-container=".vc_tta">
<span class="vc_tta-title-text">
NOT ACTIVE
</span>
</a>
</li>
<li class="vc_tta-tab vc_active" data-vc-tab="">
<a href="#1485520583544" data-vc-tabs="" data-vc-container=".vc_tta">
<span class="vc_tta-title-text">
ACTIVE
</span>
</a>
</li>
<li class="vc_tta-tab" data-vc-tab="">
<a href="#1485520583544" data-vc-tabs="" data-vc-container=".vc_tta">
<span class="vc_tta-title-text">
NOT ACTIVE
</span>
</a>
</li>
<ul>