jquery - Hidding one li items when clicked on another li item -


I used the jquery toggle function to hide drop-down menus, but if a menu is opened and I I try to open the second one, the last one is not hiding me.

  $ (document) .ready (function () {$ ("ul.subnav"). Parent (). Append ("& lt (span & gt; & lt; / span Click here (function () {$ (this) .Parent (.) Find ("ul.subnav") Toggle ('Medium'); }. Hover (function () {$ (this) .addClass ("subhover");}, function () {$ (this) .removeClass ("subhover");})}}); & lt; ul class Lt; li & gt; & lt; a href = "#" & gt; Genology & lt; / a & gt; & lt; ul class = "subnav" & gt; & lt; Li & gt; & lt; a href = "#" & gt; Scheme & lt; / a & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "#" & Gt; Leg View & lt; / li & gt; & lt; / ul & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = " # "& Gt; Smart Pin  & lt; ul class =" subnav "> 
  • & lt; ; A href = "#" & gt; My Pin & lt; / a & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "#" & gt; Send Pins & Lt; / a & gt; & lt; / li & gt; & lt; li & gt; & lt; a href = "#" & gt; Pin History & lt; / a & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Request pin & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt;

    I think your nickname initially contains some CSS (if not, please let me know Please indicate the initial status of your NAV) Try

      $ .ready (function () {$ ("ul.subnav") .Parent (). Append (" $ ("Ul.topnav li span"). Click (function () {var $ this = $ (this), $ parent = $ this Parent (), $ is shown = $ ('ul.topnav .shown'). ($ This.prev ('.subnav')); // visible subnav but one i am not checking // check if There are some subnav showing ($ Show.size ()) $ are shown ('Medium'). RemoveClass ('shown'); $ parent.find ("ul.subnav") Toggle ('Medium' ) ToggleClass ('shown');}). Hover (function () {// I think you are doing some hover effects here $ (this). AddClass ("subhover");}, function () {$ (This) .removeClass ("subhover");});});  

  • Comments

    Popular posts from this blog

    java - Can't add JTree to JPanel of a JInternalFrame -

    javascript - data.match(var) not working it seems -

    javascript - How can I pause a jQuery .each() loop, while waiting for user input? -