jQuery不透明动画 [英] jQuery opacity animation

查看:115
本文介绍了jQuery不透明动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网站,它允许用户更改视图选项。我使用jQuery来平滑动画以更改字体。它将整个页面淡出并重新使用新字体。

I am making a website, and it allows users to change view options. I use jQuery to smooth animations for font changing. It fades the whole page out and back in again with the new fonts.

淡出动画很好,但当它淡入时,没有淡入淡出。它只是弹出,没有动画。

The fade out animation is fine, but when it fades back in, there's no fade. It just pops up, no animation.

有问题的jQuery在 http://xsznix.my3gb.com/options.php

The problematic jQuery is in http://xsznix.my3gb.com/options.php.

我到目前为止的代码是:

The code I have so far is this:

$('#font-classic').click(function(){
    $(document.body).animate({opacity: '0%'},{duration: 1000, complete: function(){
        // font changing code here
        $(document.body).animate({opacity: '100%'}, 1000);
    }});
});


推荐答案

为什么不使用 jQuery 的内置函数 fadeIn fadeOut

Why not use jQuery's built-in functions fadeIn and fadeOut?

$('#font-classic').click(function(){
    $('body').fadeOut('normal', function(){
        $('body').fadeIn();
    }});
});

这篇关于jQuery不透明动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆