I’m using yui3 to do a fade-in/fade-out effect. The problem is that I can’t seem to find a way of doing this by using a class (fadein – adds a css class, fadeout – removes the class).
I only find examples of this defining a to and from background-color.
Isn’t this possible with yui3? With jquery is so simple.
Yes. Every YUI node object has a hide() and a show() method.
By default, hide() and show() just hide the node immediately. However, if you also load the ‘transition’ module alongside the ‘node’ module, you then can optionally turn the hide into a fade by calling hide(true). (You can do very fancy custom transitions, but that’s how to do a basic fade).
See http://yuilibrary.com/yui/docs/transition/transition-view.html for a detailed example that also shows off node delegation. See https://github.com/yahoo/yui3-cookbook/blob/master/examples/effects/fading.html for a more stripped down example.