mootools 中使用延迟实现淡入淡出效果的方法链接
我想在 moo 工具 1.2 中使用方法链接。
我的要求如下。
当页面加载完成时。
我的一个 div 元素说“my_div”设置为隐藏可见性。
半秒后,其不透明度设置为 0.4 半秒后再次将不透明度设置为 0.7 然后半秒后,它的不透明度再次设置为 1。
那么我如何通过 moo 工具 1.2 中的链接来做到这一点呢?
还有这个。
我可以在调用延迟方法时传递参数吗?例如
function demo(arg1, arg2)
{
// Demo code will be here
}
,那么我如何才能在延迟一秒的情况下调用这个函数并传递这两个参数呢?
I want to use method chaining in moo tools 1.2.
My requirements are as below.
When page load complete.
My one div element say "my_div" is set to hidden visibility.
After half second its opacity set to 0.4
Then again after half second its opacity set to 0.7
Then again after half second its opacity set to 1.
So how could i do this with chaining in moo tools 1.2.
And one more this.
I could i pass the parameter when i call delay method. For example
function demo(arg1, arg2)
{
// Demo code will be here
}
So how could i call this function with delay of one second and also with passing this two arguments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不知道为什么当你可以做这样的事情时你需要间隙(尝试一下,看看它是否工作得更好):
但是如果你需要按照你的规范做而不需要补间,那么做:
不需要像你一样链接无论如何,在预设时间运行更改,它们不需要互相等待。但按照建议,链接类对于动画来说非常棒, http://mootools.net/docs /more/Class/Chain.Wait
至于参数,.delay 支持:(ms、bind [this etc]、参数)(根据更改 div html 的最后一个循环示例)
not sure why you need the gaps when you can do something like this (try it and see if it works better):
but if you need to do it as per your specs without a tween, then do:
no need for chaining as you are running the changes at preset times anyway, they don't need to wait on each other. but the chaining class is awesome for animations as suggested, http://mootools.net/docs/more/Class/Chain.Wait
as for params, .delay supports: (ms, bind [this etc], arguments) (as per last cycle example that changes the div's html)
这个怎么样?
ps 我不知道适用于 IE 和 Safari,但它适用于 Firefox、Chrome 和 Opera。
How about this?
p.s. I don't know for IE and Safari, but it works on Firefox, Chrome, and Opera.
看看 Chain.Wait 额外内容: http://mootools.net/docs/ more/Class/Chain.Wait
您需要访问 http://mootools.net/more< /a> 获取包含等待扩展的自定义 MooTools 构建。
Have a look at the Chain.Wait extra: http://mootools.net/docs/more/Class/Chain.Wait
You'll need to go to http://mootools.net/more to get a custom MooTools build that includes the wait extensions.