"Sharp jquery" Reading notes four

Source: Internet
Author: User

Events and animations in jquery

I. Events

Page load

$ (document). Ready (function () {xxxxx})

Shorthand

$ (function () {
Do something
})

Element Binding Event

Bind () on ()

Bing (event type, optional parameter: Additional data object for event object, binding handler function);

Hover () toggle ()//1.91 version post-removal workaround see my other Post

Custom events

Event bubbling

<script type="Text/javascript">$ (function () {//binding The Click event for a SPAN element$('span'). Bind ("Click", function () {varTXT = $ ('#msg'). HTML () +"<p> inner span element is clicked .<p/>"; $('#msg'). html (TXT);    }); //binding The Click event for a DIV element$('#content'). Bind ("Click", function () {varTXT = $ ('#msg'). HTML () +"<p> outer div element is clicked .<p/>"; $('#msg'). html (TXT);    }); //bind the Click event to the BODY element$("Body"). Bind ("Click", function () {varTXT = $ ('#msg'). HTML () +"<p>body element is clicked .<p/>"; $('#msg'). html (TXT); });})</script>"content">Outer DIV Element<span> Inner span elements </span>Outer DIV Element</div><div id="msg"></div>

Block Default Events

Event. Stoppropagation ();  or Rturn  false
<script type="Text/javascript">             $('#content'). Bind ("Click", Function (Event){        varTXT = $ ('#msg'). HTML () +"<p> outer div element is clicked .<p/>"; $('#msg'). html (TXT); Event. Stoppropagation (); });

removing events

Unbind

Simulation Events

Trigger () and one ()

Two. Animations

Skip Show Hide

Animate () method

"Sharp jquery" Reading notes four

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.