我使用下面的jQuery脚本淡入我的下拉菜单。如何在此示例中使用 $('ul.navbar-nav li.dropdown').hover(function() {
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(50);
},
function() {
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(50);
});
?
import 'dart:io';
import 'dart:convert';
File imageFile = new File(imageFilePath);
List<int> imageBytes = imageFile.readAsBytesSync();
String base64Image = BASE64.encode(imageBytes);
答案 0 :(得分:2)
如jQuery fadeIn documentation中所述,
从jQuery 1.4.3开始,可以使用命名缓动函数的可选字符串 使用。缓动函数指定动画的速度 在动画中的不同点上进展。唯一的宽松政策 jQuery库中的实现是默认的,名为
swing
, 并且以恒定的速度进步,称为linear
。更轻松 函数可以使用插件,最值得注意的是 jQuery UI suite
这是语法
$(selector).fadeIn(speed,easing,callback)
这是一个例子
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500,"linear");
答案 1 :(得分:0)
fadeIn()方法有3个参数。您可以将缓动参数传递给fadeIn()函数。
fadeIn()语法:
$(selector).fadeIn(speed,easing,callback)
更改您的代码:
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(50);
要:
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(50,"Easing Type");
有关详细信息,请查看fadeIn()方法:
答案 2 :(得分:0)
$(选择器).fadeIn(速度,缓和,回调)
$(选择器).fadeOut(速度,缓和,回调)
要在jQuery fadeIn / fadeOut中使用不同的缓动选项,您需要填写第二个参数
示例:强>
$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(50,'linear',function(){});
jQuery的现有简易选项将是 swing 和 linear 。如果您需要更多选项,则需要使用jQuery UI suite
来自jQuery fadeIn documentation
缓解
从jQuery 1.4.3开始,可以使用命名缓动函数的可选字符串。缓动函数指定动画在动画中的不同点处进行的速度。 jQuery库中唯一的缓动实现是默认的,称为swing,以及一个以恒定速度进行的实现,称为线性。使用插件可以获得更多的缓动功能,尤其是jQuery UI套件。