jQuery callbacks.fireWith() 方法
jQuery 教程
· 2019-03-29 16:59:06
实例
访问给定的上下文"window"和数组参数调用列表中的所有回调
$(function () {
//将被添加到列表的一个简单的函数
var log = function( value1, value2 ) {
alert( "Received: " + value1 + "," + value2 );
};
var callbacks = $.Callbacks();
// 添加函数到列表
callbacks.add( log );
// 使用上下文"window"调用回调列表
// 和一个数组参数
callbacks.fireWith( window, ["foo","bar"]);
// 输出: "Received: foo, bar"
})
定义和用法
callbacks.fireWith() 函数给定上下文和参数来访问列表中的所有回调。
语法
callbacks.fireWith( [context ] [, args ] )
参数 | 描述 |
---|---|
context | 该回调列表中被触发的上下文的一个引用 |
args | 回传给回调列表的一个参数或参数列表 |
点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html
Responsive Web Design
Ethan Marcotte / Happy Cog / 2011-6 / USD 18.00
From mobile browsers to netbooks and tablets, users are visiting your sites from an increasing array of devices and browsers. Are your designs ready? Learn how to think beyond the desktop and craft be......一起来看看 《Responsive Web Design》 这本书的介绍吧!