javascript - jQuery 淡入轻松

标签 javascript jquery fadein jquery-easing

我使用下面的 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);
  });

最佳答案

jQuery fadeIn documentation 中所述,

As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing, and one that progresses at a constant pace, called linear. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.

这是语法

$(selector).fadeIn(speed,easing,callback)

这是一个例子

$(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(500,"linear");

关于javascript - jQuery 淡入轻松,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47029399/

相关文章:

javascript - 想要一个按钮,但必须在类型=文件的地方使用输入?

javascript - Angularjs 从 ng-click 启动 window.open

javascript - 仅在 Firefox 上出现 session 存储错误

jquery - 在图像 slider 中鼠标悬停时更改图像

javascript - 导航时列表项淡入淡出

javascript - jquery-ui slider 限制为使用大于 100 的数字选择列表奇怪的行为

javascript - 如何在脚本运行时显示加载图像?

javascript - jQuery 单击功能未绑定(bind)到动态更改的类

javascript - fadeIn 不起作用 jquery

jquery数组图像淡入淡出背景