Browse Source

Fixes #616 accordion removes inline styles

pull/594/merge
jlukic 10 years ago
parent
commit
e2a40f0141
1 changed files with 26 additions and 21 deletions
  1. 47
      src/modules/accordion.js

47
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)();
})

Loading…
Cancel
Save