jQuery one() 方法

jQuery 教程 · 2019-03-26 20:42:45

实例

当点击 <p> 元素时,增加该元素的文本大小(每个 <p> 元素只能触发一次事件):

$("p").one("click",function(){
$(this).animate({fontSize:"+=6px"});
});

定义和用法

one() 方法为被选元素添加一个或多个事件处理程序,并规定当事件发生时运行的函数。

当使用 one() 方法时,每个元素只能运行一次事件处理程序函数。

语法


$(selector).one(event,data,function)

参数 描述
event 必需。规定添加到元素的一个或多个事件。

由空格分隔多个事件值。必须是有效的事件。
data 可选。规定传递到函数的额外数据。
function 必需。规定当事件发生时运行的函数。

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Getting Started with C++ Audio Programming for Game Development

Getting Started with C++ Audio Programming for Game Development

David Gouveia

Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD li......一起来看看 《Getting Started with C++ Audio Programming for Game Development》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具