题
我有一个要素对象,目前,我正在呼吁。隐藏()上。相反,我想淡出的透明度整个元素(和儿童)到100%(隐藏)作为一种过渡影响也许500毫或1000毫秒。
可外汇。吐温以用这个吗?这是可能的--不脱框架的效果像这样在它的用户界面的图书馆?
解决方案
使用
$('myElement').fade('toggle')`;
它会自动淡入和淡出对象根据其状态。
实施例:HTML
<div style='background-color:black;color:white' id="tweener">
HELLO WORLD
</div>
<button onclick="javascript:doTween()">TWEEN</button>
<script type='text/javascript'>
function doTween()
{
$('tweener').fade('toggle'); // out, in are other options available.
}
</script>
其他提示
$('myElement').fade(0.7);
设置元素不透明度为70%。或
$('myElement').fade('out'); // fades the element out.
http://mootools.net/docs/core/Fx /Fx.Tween#Element:fade
<强>元法:褪色强>结果,元快捷 方法用于与透明度调整。有用 用于进出或褪色的元素 一定的不透明度水平。
在MooTools的1.3可以设置二层'选项,如持续时间或过渡,如下所示:
$('tweener').set('tween', {duration: 2000}).fade('out');
请参阅还的jsfiddle例如 http://jsfiddle.net/tofu/VU7Es/
和该文档 http://mootools.net/docs /core/Fx/Fx.Tween#Element-Properties:tween
脱有一个褪色()方法在它的外汇。吐温的包装,看到 在这里,.
不隶属于 StackOverflow