我想创建一个条件语句作为样式中的例外。我的逻辑是找到当前导航的位置,如果导航有一个标志类{expression}
脚本
$('li.navCenter').on('click', function () {
var findActiveLi = $('.footerUl').find(".currentFooterNav");//fine location of current navitation
var logoTarget = $(findActiveLi > ".logo"); // finds if currentnavli has logo class
if ($(logoTarget) == true) {
$("ul.logoUl > li").removeClass('orange blue green pink').addClass('grayLogo').css({
'background-color': ''
});
}
});
HTML(.currentFooterNav 将四处移动)
<footer id="footer">
<nav>
<ul class="footerUl">
<li id="worksFooterNavi" class="navi"><a href="#">works</a></li>
<li id="aboutFooterNavi" class="navi"><a href="#">about</a></li>
<li class="homeFooterNavi navi currentFooterNav currentAll"><a href="#" title="logo">
<div class="logo activeFooter">
<ul class="logoUl">
<li class="orange"></li>
<li class="blue"></li>
<li class="green"></li>
<li class="pink"></li>
</ul>
</div>
</a>
</li>
<li id="contactFooterNavi" class="navi"><a href="#">contact</a></li>
<li id="followFooterNavi" class="navi"><a href="#">follow</a></li>
</ul>
</nav>
</footer>
我怎样才能让这条线返回一个布尔值 == true; 必要时?
var logoTarget = $(findActiveLi > ".logo");