Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Working with jQueries .closest but its not working

    Hi,
    i´ve got this fiddle:
    Edit fiddle - JSFiddle
    Which works fine so far, but when i click on a div "trigger" every div with the class "group" opens, but only the parent div "group" should open.
    I tried this here but its not working:
    Edit fiddle - JSFiddle

    Can you help me with that?

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You should be using closest() from the current submenu which is your reference for finding its corresponding group by going up the DOM tree from that node.

    See the updated script below. The changes are in navOpen function.

    Edit fiddle - JSFiddle
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • Users who have thanked glenngv for this post:

    StanLee83 (03-27-2014)

  • #3
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •