Hi,
thanks for your hints, I managed to get it right that way. The code is
a bit different from yours, because I dont want multiple effects to
overlap. I also added a short timeout, so the effects have enough time
to finish. If someone is running into similiar problems, here is the
full code example that I use:
/**
* Create special effects for special
* navigation mouseovers.
*/
function createSpecialEffects(){
// Cache needed elements
elms = $$('div#products_new ul li a img');
runSuccess = false;
elms.each(function(slink){
slink.observe('mouseover', function(e) {
runSuccess = false;
if(typeof(this.srcelm) == 'undefined') this.srcelm =
Event.element
(e)
fadeArray = elms.without(this.srcelm);
fadeArray.each(function(ef) {
if(ef.getStyle('opacity') != 0.3)
ef.fade({
duration: 0.5,
to: 0.3,
scope: 'specials',
limit: 1
});
});
if (this.srcelm.getStyle('opacity') != 1.0) {
this.srcelm.appear({
duration: 0.5,
to: 1.0,
scope: 'specials',
limit: 1,
beforeStart: function() { runSuccess =
true; },
afterFinish: function() { runSuccess =
true; }
});
}
if(typeof(timer) != 'undefined')
window.clearTimeout(timer)
});
slink.observe('mouseout', function(e) {
if (runSuccess) {
timer = setTimeout(function() {
fadeArray.each(function(ef) {
if(ef.getStyle('opacity') !=
0.3) return;
ef.appear({
duration: 0.5,
to: 1.0,
scope: 'specials',
limit: 1
});
});
}, 500)
}
});
});
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---