如何使用 MooTools 创建延迟?

发布于 2024-12-04 18:14:07 字数 433 浏览 0 评论 0原文

我更喜欢 jquery,对 MooTools 不太熟悉。我已经在 MooTools 网站上阅读了有关创建延迟的内容,但恐怕我不够精明,无法将其添加到我的脚本中。

页面加载后,我想在这种情况发生之前添加 300 毫秒的延迟:

  window.addEvent('domready', function(){
    var data = {};
    var myShow = new Slideshow.delay(1000)('show', null, {controller: true, height: 467, hu: 'half-moon-bay-wedding/', thumbnails: true, width: 730, loop:false});
  });

我想这对于熟悉 MooTools 的人来说可能是简单的事情? 感谢您的帮助和想法!

I'm more of a jquery guy, and not too familiar with MooTools. I've read up on creating a delay on the MooTools site, but I'm afraid I'm not savvy enough to add it to my script.

After the page loads, I want to add a 300ms delay before this happens:

  window.addEvent('domready', function(){
    var data = {};
    var myShow = new Slideshow.delay(1000)('show', null, {controller: true, height: 467, hu: 'half-moon-bay-wedding/', thumbnails: true, width: 730, loop:false});
  });

I'm thinking this is probably simple stuff to someone who knows MooTools well?
Thank you for your help and thoughts!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

堇年纸鸢 2024-12-11 18:14:07

例如,您可以尝试:

window.addEvent('domready', function() {

  var data = {};
  (function() {
    var myShow = new Slideshow('show', null, {controller: true, height: 467, hu: 'half-moon-bay-wedding/', thumbnails: true, width: 730, loop:false});
  }).delay(300);

});

这样,您的 SlideShow 调用将被包装在一个匿名函数中,一旦 300 毫秒的延迟过去,该函数就会被调用。

当然可以在文档中找到更多信息: http://mootools.net/文档/核心/类型/函数#函数:延迟

You could for instance try:

window.addEvent('domready', function() {

  var data = {};
  (function() {
    var myShow = new Slideshow('show', null, {controller: true, height: 467, hu: 'half-moon-bay-wedding/', thumbnails: true, width: 730, loop:false});
  }).delay(300);

});

This way, your SlideShow call will be wrapped in an anonymous function, that will be called as soon as the delay of 300 ms has passed.

More info can of course be found in the docs: http://mootools.net/docs/core/Types/Function#Function:delay

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文