diff --git a/src/modules/accordion.js b/src/modules/accordion.js index 4bceeb083..cf91e51bd 100755 --- a/src/modules/accordion.js +++ b/src/modules/accordion.js @@ -85,15 +85,23 @@ $.fn.accordion = function(parameters) { ; module.toggle(index); }, - resetStyle: function() { - module.verbose('Resetting styles on element', this); - $(this) - .attr('style', '') - .removeAttr('style') - .children() + resetDisplay: function() { + $(this).css('display', ''); + if( $(this).attr('style') == '') { + $(this) .attr('style', '') .removeAttr('style') - ; + ; + } + }, + resetOpacity: function() { + $(this).css('opacity', ''); + if( $(this).attr('style') == '') { + $(this) + .attr('style', '') + .removeAttr('style') + ; + } } }, @@ -134,19 +142,17 @@ $.fn.accordion = function(parameters) { $previousContent .stop() .children() + .stop() .animate({ opacity: 0 - }, settings.duration, module.event.resetStyle) + }, settings.duration, module.event.resetOpacity) .end() .slideUp(settings.duration , settings.easing, function() { $previousContent .removeClass(className.active) - .attr('style', '') - .removeAttr('style') .children() - .attr('style', '') - .removeAttr('style') ; + $.proxy(module.event.resetDisplay, this)(); }) ; } @@ -156,15 +162,16 @@ $.fn.accordion = function(parameters) { $activeContent .stop() .children() - .attr('style', '') - .removeAttr('style') + .stop() + .animate({ + opacity: 1 + }, settings.duration) .end() .slideDown(settings.duration, settings.easing, function() { $activeContent .addClass(className.active) - .attr('style', '') - .removeAttr('style') ; + $.proxy(module.event.resetDisplay, this)(); $.proxy(settings.onOpen, $activeContent)(); $.proxy(settings.onChange, $activeContent)(); }) @@ -186,15 +193,13 @@ $.fn.accordion = function(parameters) { .show() .stop() .children() + .stop() .animate({ opacity: 0 - }, settings.duration, module.event.resetStyle) + }, settings.duration, module.event.resetOpacity) .end() .slideUp(settings.duration, settings.easing, function(){ - $activeContent - .attr('style', '') - .removeAttr('style') - ; + $.proxy(module.event.resetDisplay, this)(); $.proxy(settings.onClose, $activeContent)(); $.proxy(settings.onChange, $activeContent)(); })