Saturday 15 August 2015

jquery - Add class to parent li a when drop down is visible -


After having a stupid issue, when a sub menu is visible, then just add a link to a square. It's cascading and adds class to all Lee, even in a sub menu.

  & lt; Ul id = "nav" & gt; & Lt; Li & gt; & Lt; A href = "#" target = "_ self" & gt; Home & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "dropdown" & gt; & Lt; A href = "#" target = "_ self" & gt; System Manager & lt; Span aria-hidden = "true" data-icon = "& # xe000;" & Gt; & Lt; / Span & gt; & Lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" target = "_ blank" & gt; Link 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt;   

JS

  $ ('li.dropdown'). ('Mousecenter Mouseove', function (e) {e.preventDefault (); if (E.type === 'Mousecenter') $ (this). Andclass ('Hilite'); and $ (this) .removeClass ( 'Hilite');});   

CSS

  body header # header CONTAIN NAV # NAV-OUP UL # NAV Li.Dropdown Litight {Color: # DB 4105; }   

How can I get it to apply on Dropdown A and not have it cassed near the children?

You should use, just change your CSS,

  Body header #headerContain nav # nav-wrap ul # nav li dropdown. Lift & gt; A {color: # dB 4105; }    

No comments:

Post a Comment