绑定事件:bind()、on()、live()、delegate()、keyup();
触发事件:trigger(‘keyup’)、keyup();
解绑事件:unbind()、off()、die()、undelegate();
符合事件:hover() 、toggle();
事件绑定:bind();
一、绑定事件
JQuery绑定事件,除 bing() 方法之外,还有 on()、live()、one() 等
事件的绑定方法。
绑定事件分类:
(a) 绑定单个事件
$("#btn").bind("click",function(){ //代码块 console.log(123); });
(b) 同时绑定多个事件
$("#btn").bind({ mouseover:function(){ $(this).css("background","red"); console.log("代码块1"); }, mouseout:function(){ console.log("代码块2"); }, click:function(){ console.log("点击事件"); } });
JQuery中的 bind()、live()、delegate()事件方法的区别,请查阅:
http://www.php100.com/html/program/jquery/2013/0905/5993.html
二、移除事件
(a)使用 unbind() 方法 移除事件
$("button").click(function(){ $("p").unbind(); });
三、JQuery动画
在Jquery 中,提供了一系列显示动画效果的方法,其中,
show() ——— 方法控制元素的显示;
hide() ———-方法控制元素的显示;
toggle() ——-方法切换元素的可见状态;
fadeIn() ——-方法淡入;
fadeOut() ——方法淡出;
slideUp()——方法实现元素的收缩
slideDown()—方法实现元素的展开
绑定事件:bind()、on()、live()、delegate()、keyup();
触发事件:trigger(‘keyup’)、keyup();
解绑事件:unbind()、off()、die()、undelegate();
符合事件:hover() 、toggle();
事件绑定:bind();
一、绑定事件
JQuery绑定事件,除 bing() 方法之外,还有 on()、live()、one() 等
事件的绑定方法。
绑定事件分类:
(a) 绑定单个事件
$("#btn").bind("click",function(){ //代码块 console.log(123); });
(b) 同时绑定多个事件
$("#btn").bind({ mouseover:function(){ $(this).css("background","red"); console.log("代码块1"); }, mouseout:function(){ console.log("代码块2"); }, click:function(){ console.log("点击事件"); } });
JQuery中的 bind()、live()、delegate()事件方法的区别,请查阅:
http://www.php100.com/html/program/jquery/2013/0905/5993.html
二、移除事件
(a)使用 unbind() 方法 移除事件
$("button").click(function(){ $("p").unbind(); });
三、JQuery动画
在Jquery 中,提供了一系列显示动画效果的方法,其中,
show() ——— 方法控制元素的显示;
hide() ———-方法控制元素的显示;
toggle() ——-方法切换元素的可见状态;
fadeIn() ——-方法淡入;
fadeOut() ——方法淡出;
slideUp()——方法实现元素的收缩
slideDown()—方法实现元素的展开
以上就是JQuery绑定事件与移除事件、动画的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号