Skip to content

Commit

Permalink
Adds accordion animateChild option (defaults to true) related to #1558.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed Jan 5, 2015
1 parent 39aba91 commit 80c7db0
Showing 1 changed file with 36 additions and 27 deletions.
63 changes: 36 additions & 27 deletions src/definitions/modules/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,16 @@ $.fn.accordion = function(parameters) {
$activeTitle
.addClass(className.active)
;
$activeContent
.stop()
.children()
if(settings.animateChildren) {
$activeContent
.stop()
.animate({
opacity: 1
}, settings.duration, module.reset.opacity)
.end()
}, settings.duration, module.resetOpacity)
;
}
$activeContent
.stop()
.slideDown(settings.duration, settings.easing, function() {
$activeContent
.addClass(className.active)
Expand Down Expand Up @@ -193,13 +195,17 @@ $.fn.accordion = function(parameters) {
$activeContent
.removeClass(className.active)
.show()
.stop()
.children()
;
if(settings.animateChildren) {
$activeContent
.stop()
.animate({
opacity: 0
}, settings.duration, module.reset.opacity)
.end()
}, settings.duration, module.resetOpacity)
;
}
$activeContent
.stop()
.slideUp(settings.duration, settings.easing, function() {
$.proxy(module.reset.display, this)();
$.proxy(settings.onClose, this)();
Expand Down Expand Up @@ -229,22 +235,24 @@ $.fn.accordion = function(parameters) {
else {
$openTitles = $activeAccordion.find(activeSelector).not($parentTitles);
$nestedTitles = $activeAccordion.find(activeContent).find(activeSelector).not($parentTitles);
$openTitles = $openTitles.not($nestedTitles);
$openTitles = $openTitles.not($nestedTitles);
$openContents = $openTitles.next($content);
}
if( ($openTitles.size() > 0) ) {
module.debug('Exclusive enabled, closing other content', $openTitles);
$openTitles
.removeClass(className.active)
;
$openContents
.stop()
.children()
if(settings.animateChildren) {
$openContents
.stop()
.animate({
opacity: 0
}, settings.duration, module.resetOpacity)
.end()
;
}
$openContents
.stop()
.slideUp(settings.duration , settings.easing, function() {
$(this).removeClass(className.active);
$.proxy(module.reset.display, this)();
Expand Down Expand Up @@ -459,23 +467,24 @@ $.fn.accordion = function(parameters) {

$.fn.accordion.settings = {

name : 'Accordion',
namespace : 'accordion',
name : 'Accordion',
namespace : 'accordion',

debug : false,
verbose : true,
performance : true,
debug : false,
verbose : true,
performance : true,

exclusive : true,
collapsible : true,
closeNested : false,
exclusive : true,
collapsible : true,
closeNested : false,
animateChildren : true,

duration : 500,
easing : 'easeInOutQuint',
duration : 500,
easing : 'easeOutQuint',

onOpen : function(){},
onClose : function(){},
onChange : function(){},
onOpen : function(){},
onClose : function(){},
onChange : function(){},

error: {
method : 'The method you called is not defined'
Expand Down

0 comments on commit 80c7db0

Please sign in to comment.