|
|
@ -54,6 +54,7 @@ $.fn.accordion = function(parameters) { |
|
|
|
|
|
|
|
element = this, |
|
|
|
instance = $module.data(moduleNamespace), |
|
|
|
observer, |
|
|
|
module |
|
|
|
; |
|
|
|
|
|
|
@ -61,9 +62,10 @@ $.fn.accordion = function(parameters) { |
|
|
|
|
|
|
|
initialize: function() { |
|
|
|
module.debug('Initializing accordion with bound events', $module); |
|
|
|
$title |
|
|
|
.on('click' + eventNamespace, module.event.click) |
|
|
|
$module |
|
|
|
.on('click' + eventNamespace, selector.title, module.event.click) |
|
|
|
; |
|
|
|
module.observeChanges(); |
|
|
|
module.instantiate(); |
|
|
|
}, |
|
|
|
|
|
|
@ -84,6 +86,26 @@ $.fn.accordion = function(parameters) { |
|
|
|
; |
|
|
|
}, |
|
|
|
|
|
|
|
refresh: function() { |
|
|
|
$title = $module.find(selector.title); |
|
|
|
$content = $module.find(selector.content); |
|
|
|
}, |
|
|
|
|
|
|
|
observeChanges: function() { |
|
|
|
if(MutationObserver !== undefined) { |
|
|
|
observer = new MutationObserver(function(mutations) { |
|
|
|
module.debug('DOM tree modified, updating selector cache'); |
|
|
|
module.refresh(); |
|
|
|
}); |
|
|
|
observer.observe(element, { |
|
|
|
childList : true, |
|
|
|
subtree : true |
|
|
|
}); |
|
|
|
module.debug('Setting up mutation observer', observer); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
event: { |
|
|
|
click: function() { |
|
|
|
$.proxy(module.toggle, this)(); |
|
|
@ -146,8 +168,8 @@ $.fn.accordion = function(parameters) { |
|
|
|
.addClass(className.active) |
|
|
|
; |
|
|
|
$.proxy(module.reset.display, this)(); |
|
|
|
$.proxy(settings.onOpen, element)(); |
|
|
|
$.proxy(settings.onChange, element)(); |
|
|
|
$.proxy(settings.onOpen, this)(); |
|
|
|
$.proxy(settings.onChange, this)(); |
|
|
|
}) |
|
|
|
; |
|
|
|
} |
|
|
@ -180,8 +202,8 @@ $.fn.accordion = function(parameters) { |
|
|
|
.end() |
|
|
|
.slideUp(settings.duration, settings.easing, function() { |
|
|
|
$.proxy(module.reset.display, this)(); |
|
|
|
$.proxy(settings.onClose, element)(); |
|
|
|
$.proxy(settings.onChange, element)(); |
|
|
|
$.proxy(settings.onClose, this)(); |
|
|
|
$.proxy(settings.onChange, this)(); |
|
|
|
}) |
|
|
|
; |
|
|
|
} |
|
|
@ -435,6 +457,7 @@ $.fn.accordion = function(parameters) { |
|
|
|
}; |
|
|
|
|
|
|
|
$.fn.accordion.settings = { |
|
|
|
|
|
|
|
name : 'Accordion', |
|
|
|
namespace : 'accordion', |
|
|
|
|
|
|
@ -467,7 +490,6 @@ $.fn.accordion.settings = { |
|
|
|
content : '.content' |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
// Adds easing
|
|
|
|