控制MooTools 1.2中淡入淡出功能的持续时间

发布于 2024-12-29 19:22:30 字数 521 浏览 2 评论 0原文

我在 MooTools 1.2 中使用了一个非常简单的淡入淡出函数(由于在同一页面上调用另一个函数,我“必须”使用 MooTools 1.2)。我基本上是在页面上淡入标题。一切都很好,但我似乎找不到有关如何简单地控制持续时间的文档。我发现的所有内容似乎都引用了其他函数,我想使其尽可能简单。这是我得到的 javascript:

window.addEvents({
    load: function(){
        var singleImage = $('myimage2');
        singleImage.set('styles', {
            'opacity': 0,
            'visibility': 'visible'
        });
        singleImage.fade('in');
    }
});

如您所见,它采用 id="myimage2" 的图像(我最初用 CSS 隐藏了该图像),并在文档准备好时淡入。它消失得很快,我希望它能逐渐消失。有什么想法吗?谢谢。

I'm using a very simple fade function with MooTools 1.2 (I 'have' to use MooTools 1.2 due to a complication over another function being called on the same page). I'm basically fading a title in on my page. Everything works great but I can't seem to find documentation on how to control the duration simply. Everything I find seems to refer to other functions and I'd like to keep this as simple as possible. Here's the javascript I've got:

window.addEvents({
    load: function(){
        var singleImage = $('myimage2');
        singleImage.set('styles', {
            'opacity': 0,
            'visibility': 'visible'
        });
        singleImage.fade('in');
    }
});

So as you see, it takes an image with id="myimage2" (which I have initially hidden with CSS) and fades in when the document is ready. It fades in quickly and I'd like it to fade in more gradually. Any ideas? Thanks.

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

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

发布评论

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

评论(1

岁月蹉跎了容颜 2025-01-05 19:22:30

使用上一个问题中的示例 - http://jsfiddle.net/RNeS5/208/

// set-up an event on the browsers window
window.addEvents({

    // be sure to fire the event once the document is fully loaded
    load: function(){

        // assing 'singleImage' variable to the image tag with the 'image' ID
        var singleImage = $('image');

        // set a bunch of CSS styles to the aforementioned image
        singleImage.set('styles', {
            'opacity': 0,
            'visibility': 'visible'
        });

        // fade in the image
        singleImage.set('tween', { duration: 2000 }).fade('in');
    }
});

Using the example from your previous question - http://jsfiddle.net/RNeS5/208/

// set-up an event on the browsers window
window.addEvents({

    // be sure to fire the event once the document is fully loaded
    load: function(){

        // assing 'singleImage' variable to the image tag with the 'image' ID
        var singleImage = $('image');

        // set a bunch of CSS styles to the aforementioned image
        singleImage.set('styles', {
            'opacity': 0,
            'visibility': 'visible'
        });

        // fade in the image
        singleImage.set('tween', { duration: 2000 }).fade('in');
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文