jQuery的淡入“慢"太快 [英] Jquery's fadein 'slow' is too fast

查看:82
本文介绍了jQuery的淡入“慢"太快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有慢速选项的jQuery淡入淡出,但对于我来说还是有点太快了. 现在,我读到您只能在快和慢之间进行选择,但是有没有办法使它变慢?

i'm using the jquery fadein fadeout with the slow option, but it's still a little too fast for me. now i've read that you can only choose between fast and slow, but is there a way to make it slower?

推荐答案

您有两个选择.第一种是在通话中使用毫秒数:

You have two options. The first is to use a number of milliseconds in the call:

$('#myItem').fadeOut(1500); // 1.5 seconds

第二个选项是定义自定义速度,或者重新定义jQuery的本机速度:

The second option is to define a custom speed, or to redefine a jQuery native speed:

$.fx.speeds.slow = 1500; // 'slow' now means 1.5 seconds
$.fx.speeds.xslow = 3000; // 'xslow' means 3 seconds
$.fx.speeds.xfast = 100; // 'xfast' means 0.1 seconds

然后您可以像平常一样称呼他们

You can then call them as normal:

$('#myItem').fadeOut('slow');
$('#myItem').fadeOut('xslow');
$('#myItem').fadeOut('xfast');

这使您可以在整个应用程序范围内重新定义速度.

This allows you to redefine speeds on an application-wide basis.

这篇关于jQuery的淡入“慢"太快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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