javascript - Change in child accordion indicator icon twitter bootstrap -


i have 2 level twitter bootstrap accordion drop down indicator icons. problem when close sub-group indicator changes in parent too. (sorry bad english)

$('.accordion-body').on('show', function() {    $(this).siblings('.accordion-heading').children('.ui-icon').removeclass('ui-icon-triangle-1-e').addclass('ui-icon-triangle-1-s'); });  $('.accordion-body').on('hide', function() {    $(this).siblings('.accordion-heading').children('.ui-icon').removeclass('ui-icon-triangle-1-s').addclass('ui-icon-triangle-1-e'); }); 

jsfiddle

uhm, pretty obscure, here's cause: "show" , "hide" events bubble default, hide/show event firing in sub-collapsible getting catched parent collapsibles.

the solution tweak listeners way:

$('.accordion-body').on('show', function(e) {     e.stoppropagation();     … } 

here working version of fiddle: http://jsfiddle.net/hwnyb/2/.

sidenote:

e.stoppropagation();  

has ie counterpart:

e.cancelbubble = true;  

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -