jquery - Change class of Panel right before the click -
how can change class before animation starts/open/close panel? class changes after animation/panel opened or closed.
example: http://jsfiddle.net/0b9jppve/
actual code:
$('#accordion').find('.panel-default:has(".in")').addclass('panel-danger'); $('#accordion').on('shown.bs.collapse', function (e) { $(e.target).closest('.panel-default').addclass(' panel-danger'); }).on('hidden.bs.collapse', function (e) { $(e.target).closest('.panel-default').removeclass(' panel-danger'); })
all need change events you're listening for. events hide.bs.collapse
, show.bs.collapse
fire when animation starts, hidden.bs.collapse
, shown.bs.collapse
fire on completion.
$('#accordion').on('show.bs.collapse', function (e) { $(e.target).closest('.panel-default').addclass(' panel-danger'); }).on('hide.bs.collapse', function (e) { $(e.target).closest('.panel-default').removeclass(' panel-danger'); })
Comments
Post a Comment