本文介绍了多个匹配元素的触发器属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我有三个包含属性的容器。我想在具有公共attr的父级上为所有匹配元素添加一个类。但问题是在一个容器匹配元素类已被添加但不是所有三个容器的匹配元素。
这里是代码:
Hi everyone.
I've three containers that contain a attribute. I wanna add a class for all matches element on a parent that have common attr. But the problem is on one container matches element class has been added but not all three container's match element.
here is code :
<!-- container 1 on header -->
<ul class="dropdown-menu">
<li>
<a data-toggle="tab" class="" link-tab="lt-department" href="">Departments</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-styles" href="">Styles</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-style-size" href="">Style Sizes</a>
</li>
</ul>
<!-- container 2 on left sidebar -->
<ul class="sidebar-menu">
<li>
<a data-toggle="tab" class="" link-tab="lt-department" href="">Departments</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-styles" href="">Styles</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-style-size" href="">Style Sizes</a>
</li>
</ul>
<!-- container 3 on main page -->
<ul class="tab-menu">
<li>
<a data-toggle="tab" class="" link-tab="lt-department" href="#departmentsContainer">Departments</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-styles" href="#tblStyles">Styles</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-style-size" href="#styleSizesContainer">Style Sizes</a>
</li>
</ul>
我想要这样的东西
if我从三个容器中的任何一个点击li-department
I wanna somthing like this
if i clicked on li-department from any one of the three containers
<!-- container 1 on header -->
<ul class="dropdown-menu">
<li>
<a data-toggle="tab" class="active" link-tab="lt-department" href="">Departments</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-styles" href="">Styles</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-style-size" href="">Style Sizes</a>
</li>
</ul>
<!-- container 2 on left sidebar -->
<ul class="sidebar-menu">
<li>
<a data-toggle="tab" class="active" link-tab="lt-department" href="">Departments</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-styles" href="">Styles</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-style-size" href="">Style Sizes</a>
</li>
</ul>
<!-- container 3 on main page -->
<ul class="tab-menu">
<li>
<a data-toggle="tab" class="active" link-tab="lt-department" href="#departmentsContainer">Departments</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-styles" href="#tblStyles">Styles</a>
</li>
<li>
<a data-toggle="tab" link-tab="lt-style-size" href="#styleSizesContainer">Style Sizes</a>
</li>
</ul>
推荐答案
这篇关于多个匹配元素的触发器属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!