Events and animations in jquery

Source: Internet
Author: User

1. Mouse events

Method describes the timing of the execution


Click () triggers or binds a function to the clicked event of the specified element when the mouse clicks
MouseOver () MouseOver event that triggers or binds a function to a specified element the mouse pointer is moved out of date
Mouseout () triggers or binds a function to the Mouseout event of the specified element when the mouse pointer moves out
MouseEnter () triggers or binds a function to the MouseEnter event of the specified element when the mouse pointer enters
MouseLeave () Touch or bind a function to the MouseLeave event of the specified element when the mouse pointer leaves

2. Keyboard events

Method Execution Timing Description

KeyDown () triggers or binds a function to the KeyDown event of the specified element when the keyboard is pressed

KeyUp () triggers or binds a function to the KeyUp event release key of the specified element

KeyPress () triggers or binds a function to the KeyPress event of a specified element to produce a printable character



----------------Browser Events
Resize () sizing

-----------------------
3. Event Binding
To bind multiple events:

$ (DOM). Bind ({mouseover:function () {},mouseout:function () {}});

  

To unload a partial event:
Unbind ("A B C")

On

When Unbind () does not take arguments, it means that all the events bound are removed

3. Composite Events

Hover () method

The first Topdown is the trigger when the cursor is moved, and the second Topdown is the trigger when the cursor moves out .

$ (". Top-m. On"). Hover (function () {$ (". Topdown"). Show ();          },         function () {$ (". Topdown"). Hide ();         });

Toggle () method

$ ("input"). Toggle (        function () {$ ("body"). CSS ("Background", "#ff0000");},         function () {$ ("body"). CSS (" Background "," #00ff00 ");},          function () {$ (" body "). CSS (" Background "," #0000ff ");}    )

  

Toggle () and Toggleclass () summary
Toggle (Fn1,fn2 ...) Enables click events to be toggled without the need for additional bindings click events
Toggle () Implements the event trigger object to toggle between the display and the hidden state
Toggleclass () Implements an event trigger object to toggle between loading a style and removing a style

Event: triggered by xxx
Event: An action that triggers something and performs an effect
Event: This event is executed by an action to return a result
Event: The object that triggered the event, associated with the method that handles the event.

4. Custom animations
$ ("[Type=button]"). Bind ("click", Function () {
Queue:
$ ("div")
. Animate ({"font-size": "50px"},2000,function () {alert (' AA ');})
. Animate ({"width": "200px"},{Queue:false, duration:2000});
});
Queue: Joins the queue, with the default value of True. Wait for the first animation to complete before you finish the second animation

Animate ({CSS style},{duration=3000,queue:false});

5.show () and Hide ()

Show () control element Display, hide () control element hidden

6.slideDown () and Slideup ()

Slidedown () allows elements to be progressively extended to display
Slideup () makes the elements progressively shorter until they are hidden

$ (document). Ready (function () {       $ ("H2"). Click (function () {   $ (". txt"). Slideup ("slow")   ; $ (". txt"). Slidedown ("slow");       }); });

  


7.fadeIn () and fadeout ()

FadeIn () and fadeout () can fade effects by changing the transparency of elements

Events and animations in jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.