.delay()

.delay( duration [, queueName ] )Returns: jQuery

Description: Set a timer to delay execution of subsequent items in the queue.

  • version added: 1.4.delay( duration [, queueName ] )

    • duration
      Type: Integer
      An integer indicating the number of milliseconds to delay execution of the next item in the queue.
    • queueName
      Type: String
      A string containing the name of the queue. Defaults to fx, the standard effects queue.

Added to jQuery in version 1.4, the .delay() method allows us to delay the execution of functions that follow it in the queue. It can be used with the standard effects queue or with a custom queue. Only subsequent events in a queue are delayed; for example this will not delay the no-arguments forms of .show() or .hide() which do not use the effects queue.

Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings 'fast' and 'slow' can be supplied to indicate durations of 200 and 600 milliseconds, respectively.

Using the standard effects queue, we can, for example, set an 800-millisecond delay between the .slideUp() and .fadeIn() of <div id="foo">:

$( "#foo" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );

When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds.

The .delay() method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay() is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases.

jQuery .delay()的更多相关文章

  1. jquery delay()介绍及使用指南

    .delay()是用来在jQuery动画效果和类似队列中是最好的.但是,由于其本身的限制,比如无法取消延时——.delay(),它不是JavaScript的原生 setTimeout函数的替代品,这可 ...

  2. jQuery delay() 方法

    定义和用法 delay() 方法对队列中的下一项的执行设置延迟. 语法 $(selector).delay(speed,queueName) 参数 描述 speed 可选.规定延迟的速度. 可能的值: ...

  3. JQuery Delay Hover效果

    CSS代码 .tbui_aside_float_bar { position: fixed; left: 50%; bottom: 120px; margin-left: 608px; border- ...

  4. 深入理解JS异步编程五(脚本异步加载)

    异步脚本加载 阻塞性脚本 JavaScript在浏览器中被解析和执行时具有阻塞的特性,也就是说,当JavaScript代码执行时,页面的解析.渲染以及其他资源的下载都要停下来等待脚本执行完毕 浏览器是 ...

  5. Angular源代码学习笔记-原创

    时间:2014年12月15日 14:15:10 /** * @license AngularJS v1.3.0-beta.15 * (c) 2010-2014 Google, Inc. http:// ...

  6. JS页面延迟执行一些方法(整理)

    一般在JS页面延迟执行一些方法.可以使用以下的方法 jQuery.delay()方法简介 http://shawphy.com/2010/11/jquery-delay.html jQuery中que ...

  7. Angularjs 源码

    /** * @license AngularJS v1.3.0-beta.15 * (c) 2010-2014 Google, Inc. http://angularjs.org function t ...

  8. 使用jquery的delay方式模拟sleep

    javascript中并没有原生sleep函数可供调用,一般来说为了实现sleep功能,大都是采用SetTimeout来模拟,以下片段采用jquery的delay方法来模拟,也算是提供了另外一个视角吧 ...

  9. jQuery学习之路(4)- 动画

    ▓▓▓▓▓▓ 大致介绍 通过jQuery中基本的动画方法,能够轻松地为网页添加非常精彩的视觉效果,给用户一种全新的体验 ▓▓▓▓▓▓ jQuery中的动画 ▓▓▓▓▓▓ show()和hide()方法 ...

随机推荐

  1. luogu P2605 [ZJOI2010]基站选址

    luogu 先考虑朴素dp,设\(f_{i,j}\)表示在第\(i\)个村庄放了基站,一共放了\(j\)次,且只考虑前面村庄影响的答案.这里可以把\(j\)放在外面枚举,然后从\(f_{k,j-1}( ...

  2. Django 使用request获取浏览器发送的参数(Django编程-5)

    1.url:需要正则去匹配 url(r'^index/(num)/$',view.index) 匹配到的参数会自动传入对应的视图函数 也可以给匹配到的参数起名字?P url(r'^index/(?P& ...

  3. Ubuntu环境变量设置注意点

    设置环境变量时,有一点要注意: /etc/bash.bashrc与/etc/profile是有区别的 什么区别呢? 打开一个新的shell时,会读取/etc/bash.bashrc和~/.bashrc ...

  4. Linux禁止root远程登录及修改默认端口

    1.1 修改SSHD配置,禁止root远程登录 禁止登录之前先穿甲一个可以远程登录的普通用户,以免造成登录不了的情况 [root@jhkj66 ~]# useradd yw001 #创建用户 [roo ...

  5. Memcached安装部署

    Memcached安装部署 发表回复 简述: Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提供 ...

  6. Acwing-121-赶牛入圈(二分, 二维前缀和,离散化)

    链接: https://www.acwing.com/problem/content/123/ 题意: 农夫约翰希望为他的奶牛们建立一个畜栏. 这些挑剔的畜生要求畜栏必须是正方形的,而且至少要包含C单 ...

  7. 【51nod1220】约数之和

    题目 d(k)表示k的所有约数的和.d(6) = 1 + 2 + 3 + 6 = 12. 定义S(N) = ∑1<=i<=N ∑1<=j<=N d(i*j). 例如:S(3) ...

  8. Python网络爬虫_爬取Ajax动态加载和翻页时url不变的网页

    1 . 什么是 AJAX ? AJAX = 异步 JavaScript 和 XML. AJAX 是一种用于创建快速动态网页的技术. 通过在后台与服务器进行少量数据交换,AJAX 可以使网页实现异步更新 ...

  9. json从后台接收时转化格式

    后台传回的json格式为字符串格式 需要通过转化成json对象 方法一:$.get(设置type的属性为json) 方法二:设置response.setContentType("applic ...

  10. BZOJ 1095: [ZJOI2007]Hide 捉迷藏 动态点分治+堆

    写了7k多,可以说是一己之力切掉了这道毒瘤题~ 开 $3$ 种堆,分别维护每个子树最大深度,以及每个节点在点分树中对父亲的贡献,和全局的最优解. 由于需要支持堆的删除,所以写起来特别恶心+麻烦. 细节 ...