Hey Tim,
Tim Bellinghausen a écrit :
> It should be possible to use it repeatedly, I use it to blend in/off
> a layer with some options.
>
> Before first call: opacity: 0,
> On first call: let the element appear, final opacity: 0.8
> One second call: fade the element, final opacity: 0
> and so on.
Alright.
> To reach, that the appear part of the toggle finshes with an opacity
> of 0.8 I treid to set to:0.8, but this causes the fade to stop
> working, because it also gets the to property set to 0.8, and thats
> the problem. I think I need to do my own toggle, but I would be happy
> for any idea.
Yeah, that's nominal behavior. That's because your options hash is
passed untouched (or almost so) to the effects, therefore the fade has a
to:0.8 to...
By default, Appear and Fade use 0-X and X-0 as from/to, where X is the
element's current opacity.
So you'd have to create your own toggler. Probably something like this
(ugh, massive redundancy over existing code, *sob*):
Effect.boundToggleAppear = function(element, maxOpacity) {
if (undefined === maxOpacity)
maxOpacity = 1.0;
element = $(element);
var inOptions = Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 },
from: 0, to: maxOpacity
}, arguments[2] || {});
var outOptions = Object.extend(inOptions, {
from: maxOpacity, to: 0 });
var options = element.visible() ? outOptions : inOptions;
Effect[element.visible() ? 'Fade' : 'Appear'](element, options);
};
Didn't test. 'Should work, though.
--
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---