JQuery accordion - binding header headers only

Ive created a JQuery accordion using this generator - http://code.anotherwebstorm.com/apps/awsaccordion/

However, there are links in the content areas of my accordion tabs and when these links are clicked the tab will automatically close. I need the tab to stay open when these content links are clicked. Only when you click on the title of a tab should the tab be closed. The creator of this script no longer supports it, but gave me an idea of ​​what to do, which is here:

"I think you need to go into the kernel and change it to listen for the anchor only on push, not inside. I think the key is here https://github.com/anotherwebstorm/awsAccordion/blob/master /jquery.accordion.js#L55 on this line.

All click events are bound to headLis, so if you do a couple of conditionals and / or only set the heading bindings they should fix that. "

Unfortunately, I don't know how to implement what he described. Any help with this is greatly appreciated!

thank

+3


source to share


1 answer


headLis = elem.children().children()

      

This is where all your elements are initialized; now, before the click event binding occurs over the elements of this array, you can remove elements from this array by doing your own check



headLis = elem.children().children()


$headLis.each(function(){

   if(your custom check for link to be removed)
    // remove element 
})

      

check this fiddle eg. Please check comments

0


source







All Articles