自己定义jQuery事件
来源:互联网 发布:淘宝hd历史版本 编辑:程序博客网 时间:2024/05/22 15:24
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>delegate demo</title>
<style>
p {
color: red;
}
span {
color: blue;
}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p>Has an attached custom event.</p>
<button>Trigger custom event</button>
<span style="display:none;"></span>
<script>
$( "body" ).delegate( "p", "myCustomEvent", function(e, myName, myValue ) {
$( this ).text( "Hi there!" );
$( "span" )
.stop()
.css( "opacity", 1 )
.text( "myName = " + myName )
.fadeIn( 30 )
.fadeOut( 1000 );
});
$( "button" ).click(function() {
$( "p" ).trigger( "myCustomEvent",["aaa","二十岁"]);
});
</script>
</body>
</html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>delegate demo</title>
<style>
p {
color: red;
}
span {
color: blue;
}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p>Has an attached custom event.</p>
<button>Trigger custom event</button>
<span style="display:none;"></span>
<script>
$( "body" ).delegate( "p", "myCustomEvent", function(e, myName, myValue ) {
$( this ).text( "Hi there!" );
$( "span" )
.stop()
.css( "opacity", 1 )
.text( "myName = " + myName )
.fadeIn( 30 )
.fadeOut( 1000 );
});
$( "button" ).click(function() {
$( "p" ).trigger( "myCustomEvent",["aaa","二十岁"]);
});
</script>
</body>
</html>
0 0
- 自己定义jQuery事件
- jQuery定义自己函数
- 自己为UI定义事件
- C++Builder中定义自己的事件
- asp.net 中的自己定义事件
- 手机web自己定义滑动事件
- 第九章(2)-定义自己的事件-学习笔记
- Jquery库和自己定义库的区别
- 使用jquery定义按钮触发事件 无法响应
- jQuery来了--定义,引用,语法,文档就绪事件,选择器
- C#事件-定义事件
- 4.在JBoss中自己定义JAAS登录模块处理登录事件
- 用浏览器控件做界面,网页界面中定义自己的程序事件
- 给Ajax.Request的onComplete事件增加自己定义的参数
- 给Ajax.Request的onComplete事件增加自己定义的参数
- jQuery事件
- jquery事件
- JQuery事件
- 梦想经不起等待,今天起就行动吧!
- php和Mysql web开发 第一章 php快速入门
- ucosii在stm32上的移植详解1
- (007):使用LINQ进行数据转换(C#)
- java将IP地址转换为数字以及逆向转换(位运算和0xFF的使用)第二季
- 自己定义jQuery事件
- (008):将多个输入联接到一个输出序列
- (二次总结)Firefox Flash控件崩溃问题解决
- 百度面试题之桶中取球(咖啡罐问题的变形)
- linux java安装
- sugarnms如何快速实现网管软件定制开发?
- MapReduce:详解Shuffle过程
- window7 语音识别开发(sapi)
- 我的书单