Home > Article > Web Front-end > JQuery binding events, removal events and animations
BindingEvent: bind(), on(), live(), delegate(), keyup();
Trigger event: trigger( 'keyup'), keyup();
Unbinding events: unbind(), off(), die(), undelegate();
Conforming events: hover(), toggle();
Events Binding: bind();
##1. Binding event
JQueryBinding events, in addition to the bing() method, there are also
on(),
live(),
one( ) Binding methods for other
events.
Binding event classification:
(a) Binding a single event$("#btn").bind("click",function(){ //代码块 console.log(123); });(b) Binding multiple events at the same time
$("#btn").bind({ mouseover:function(){ $(this).css("background","red"); console.log("代码块1"); }, mouseout:function(){ console.log("代码块2"); }, click:function(){ console.log("点击事件"); } });For the differences between bind(), live(), and delegate() event methods in JQuery, please check:
http://www.php100.com/html/program/jquery/2013/0905/5993. html
(a) Use the unbind() method to remove the event
$("button").click(function(){ $("p").unbind(); });In Jquery, a series of methods for displaying animation effects are provided, among which,
show() ——— Method controls the display of elements;
hide() — ——-Method to control the display of elements;
toggle() ——-Method to switch the visible
state of elements;
fadeIn() ——-Method fade in;
fadeOut() ——Method fade out;
slideUp()——Method to realize the shrinkage of elements
slideDown()——Method Implement the expansion of elements
Unbinding events: unbind(), off(), die(), undelegate();
Conforming events: hover(), toggle ();
Event binding: bind();
##1. Binding events
JQuery binding events, in addition to the bing()
method, there are alsoon(),
live(),
one () Binding methods for
and other events.
Binding event classification:
(a) Binding a single event
$("#btn").bind("click",function(){ //代码块 console.log(123); });(b) Binding multiple events at the same time
$("#btn").bind({ mouseover:function(){ $(this).css("background","red"); console.log("代码块1"); }, mouseout:function(){ console.log("代码块2"); }, click:function(){ console.log("点击事件"); } });For the differences between bind(), live(), and delegate() event methods in JQuery, please check:
http://www.php100.com/html/program/jquery/2013/0905/5993. html
2. Remove the event
(a) Use the unbind() method to remove the event
$("button").click(function(){ $("p").unbind(); });3. JQuery animation
In Jquery, a series of methods for displaying animation effects are provided, among which,
The above is the detailed content of JQuery binding events, removal events and animations. For more information, please follow other related articles on the PHP Chinese website!