if($('.navigation ul li ul').children().length === 1) {
$('.navigation ul li ul li a').css({opacity:0.5});
}
else {
$('.navigation ul li ul li:first-child a').addClass('first');
$('.navigation ul li ul li:last-child a').addClass('last');
}
In this code snippet, the navigation behavior is set differently based on the number of list items it contains in the unordered list.
For example:
<nav id="nav" class="navigation"><!--Start Navigation-->
<ul>
<li><a href="#">Sample Linkk</a>
<ul>
<li><a href="#">1 DropDown Item</a></li>
</ul>
</li>
<li><a href="#">Sample Link 2</a>
<ul>
<li><a href="#">2 DropDown Items</a></li>
<li><a href="#">2 DropDown Items</a></li>
</ul>
</li>
</ul>
</nav>