您现在的位置: 主页 > 嵌入式操作系统 > Linux > jQuery Mobile bind()方法---处理自定义事件
本文所属标签:
为本文创立个标签吧:

jQuery Mobile bind()方法---处理自定义事件

来源:网络整理 网络用户发布,如有版权联系网管删除 2018-08-17 

jQuery Mobile提供的自定义事件建立了超出框架原生功能的实用开发钩子,意味着我们可以拦截某些现有的事件,添加自己的自定义代码,这些事件包括touch、mouse和window事件。

1: $('div.foo').bind('click',function(e) {

// todo

});

2: $('div.foo').click(function(e) {

//todo

});

1和2的差别在于,bind方法可以同时响应多个事件。

$('div.foo').bind('mouseenter mouseleave',function(e) {

// todo

});

自定义displayMyName事件

$('div.foo').bind('displayMyName', function(e, myName) {

alert("my name is: " + myName);

});

$('div.foo').click(function() {

$('div.foo').trigger('displayMyName', ['John']);

});



              查看评论 回复



嵌入式交流网主页 > 嵌入式操作系统 > Linux > jQuery Mobile bind()方法---处理自定义事件
 可以 自定义 事件

"jQuery Mobile bind()方法---处理自定义事件"的相关文章

网站地图

围观()