Making JQuery horizontal accordion close on click

Posted by user310404 on Stack Overflow See other posts from Stack Overflow or by user310404
Published on 2010-04-06T21:31:32Z Indexed on 2010/04/06 21:33 UTC
Read the original article Hit count: 190

Filed under:
|
|

Example: http://vincent-massaro.com/map/

Currently, the script allows you to click on a piece of the accordion to open it, but it is set to close on mouseleave. When I set the mouseleave to .click, it gets confused and doesn't know what state it is in. The code controlling this is below, and the full script is in haccordion.js linked in the page source. If someone could help me modify this script, I would be very grateful! Thanks in advance.

$target.click(function(){
            haccordion.expandli(config.accordionid, this)
                    config.$lastexpanded=$(this)
  })
            if (config.collapsecurrent){ //if previous content should be contracted when expanding current
                    $target.mouseleave(function(){
                          $(this).stop().animate({width:config.paneldimensions.peekw}, config.speed)
  })
  }

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about accordion