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'); });
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
Post a Comment