Hi guys,
I use the functions BlindUp/BlindDown from the effects file of the Prototype/Scriptaculous library (functions that I don't fully understand) :
I call those functions from a script of mine as follow :
The problem is that I want to prevent my function ad_toggle from doing anything before BlindUp/BlindDown have completed their respective task (until a div is fully open/closed).
So, my question is : how do I detect this, and is it possible without changing the code of the Prototype/Effects library?
Thanks a lot for the help
I use the functions BlindUp/BlindDown from the effects file of the Prototype/Scriptaculous library (functions that I don't fully understand) :
Code:
Effect.BlindUp = function(element) {
element = $(element);
element.makeClipping();
return new Effect.Scale(element, 0,
Object.extend({ scaleContent: false,
scaleX: false,
restoreAfterFinish: true,
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping();
}
}, arguments[1] || { })
);
};
Effect.BlindDown = function(element) {
element = $(element);
var elementDimensions = element.getDimensions();
return new Effect.Scale(element, 100, Object.extend({
scaleContent: false,
scaleX: false,
scaleFrom: 0,
scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
restoreAfterFinish: true,
afterSetup: function(effect) {
effect.element.makeClipping().setStyle({height: '0px'}).show();
},
afterFinishInternal: function(effect) {
effect.element.undoClipping();
}
}, arguments[1] || { }));
};
I call those functions from a script of mine as follow :
Code:
function ad_toggle ( action , num ) {
var title = document.getElementById( 'ti' + num );
var content = document.getElementById( 'co' + num );
var text = document.getElementById( 'te' + num );
var caption = document.getElementById( 'ca' + num );
if (action == 'open') {
if (content.style.display != 'none') {
Effect.BlindUp(content);
title.className = 'closed';
caption.className = 'on';
} else {
Effect.BlindDown(content);
title.className = 'open';
caption.className = 'off';
}
} else {
if (content.style.display == 'none') {
if (action == 'turnon') {
title.className = 'open';
caption.className = 'hover';
}
if (action == 'turnoff') {
title.className = 'closed';
caption.className = 'on';
}
}
}
}
The problem is that I want to prevent my function ad_toggle from doing anything before BlindUp/BlindDown have completed their respective task (until a div is fully open/closed).
So, my question is : how do I detect this, and is it possible without changing the code of the Prototype/Effects library?
Thanks a lot for the help