1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-19 05:28:10 +01:00

* added toggleManyObserver for toggleing multiple elements from a single anchor tag

This commit is contained in:
bugrain 2009-07-16 23:16:29 +00:00
parent f82158dce9
commit af48109bb0

View File

@ -8,9 +8,9 @@
* e107 Javascript API
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $
* $Revision: 1.31 $
* $Date: 2009-04-23 10:16:35 $
* $Author: secretr $
* $Revision: 1.32 $
* $Date: 2009-07-16 23:16:29 $
* $Author: bugrain $
*
*/
@ -839,6 +839,28 @@ Object.extend(e107Helper, {
}.bindAsEventListener(e107Helper));
},
/**
* Event listener - e107:loaded|e107:ajax_update_after
* Runs fxToggle against multiple elements. The trigger element is an anchor tag, IDs of the elements to be toggled are defined in
* the 'href' attribute separated by a hash character (including a leading hash), e.g. href='#id1#id2#id3'
* @see e107Core#addOnLoad
*/
toggleManyObserver: function(event) {
var element = event.memo['element'] ? $(event.memo.element) : $$('body')[0];
Element.select(element, '.e-swapit').invoke('observe', 'click', function(e) {
var element = e.findElement('a');
var els = element.readAttribute('href').split('#').without('');
els.each(function(el) {
if ($(el)) {
$(el).fxToggle({
options: { duration: 0.5, queue: { position: 'end', scope: 'toggleManyObserver'} }
});
}
});
e.stop();
}.bindAsEventListener(e107Helper));
},
/**
* Add fx scroll on click event
* on all <a href='#something" class="scroll-to"> elements
@ -2647,6 +2669,6 @@ function sendInfo(handler, container, form) {
/*
* Core Auto-load
*/
$w('autoExternalLinks autoNoHistory autoHide toggleObserver scrollToObserver').each( function(f) {
$w('autoExternalLinks autoNoHistory autoHide toggleObserver toggleManyObserver scrollToObserver').each( function(f) {
e107.runOnLoad(e107Helper[f], null, true);
});