Learn in FCC (5)

Source: Internet
Author: User

Chapter III JQuery
I did not expect to tell JS before the first to a jquery.
1.$ (document). Ready (function () {});.
2.$ ("button"). AddClass ("animated bounce"); Add bounce action to the button. jquery can add class to an element. Animate.css, the original class can also let the elements move up.
3.addClass ("Animated Shake"), plus vibration class. At the same time add bounce and vibration, the elements will be more solid moving up.
4.$ ("#target6"). AddClass ("animated fadeOut"); ID selector. Fade out action. Here I suddenly have a question, why use the addition class to achieve fade, instead of using the fadeout () method? The latter is supposed to be more flexible when used with parameters. And too much use of the class feeling will be very messy.
5. Excessive action will be distracting, delete the previously added action class.
6. A variety of selectors, elements, classes, IDS, etc. The jquery selector is based on existing CSS selectors, in addition to some custom selectors.
7.$ ("button"). Removeclass ("Btn0default"); As with adding classes, you can also delete classes.
8.$ ("#target1"). CSS ("Color", "red"); Call the jquery method to change the CSS style of the element.
9. $ ("Target1"). Prop ("Disabled", true); Call the jquery method to modify the element properties.
10.$ ("Target4"). HTML ("<i> #target4 </i>"). The HTML () method can replace the text content of an element with other elements and text. The text () method will only change the literal.
11.$ ("Target4"). Remove (); the Remove () method removes the entire element.
$ ("Target2"). AppendTo ("#right-well"); the AppendTo () method can transfer one element to another element.
13.$ ("Target5"). Clone (). AppendTo ("#left-well"); the Clone () function can create a clone of an element. (I suddenly feel that for JS, it might be better to have function called functions.) ) function chaining, the chain of functions.
. $ ("#target1"). Parent (). CSS ("Background-color", "Red"); Call the parent () function to access the parents of an element.
15.$ ("#right-well"). Children (). CSS ("Color", "green"), call the Children () function to access the child elements of an element.
$ (". Target:nth-child (2)"). AddClass ("animated bounce"); here's the point. Use the CSS selector to select a specific child element.
$ (". Target:odd"). AddClass ("animated shake"); Adds a vibrating action to the odd sequence in the child element. Since the array in JS is starting from 0, it is actually the 2,4,6: the child element. The opposite is ": even", even sequence.
18.$ ("Body"). AddClass ("animated hinge"); You can select the entire BODY element. Hinge action, elements fall off.
At this point, the 3-hour jquery primer is done. Feel insisted to do a lot of days, but in fact, until now completed 13 hours, think of altogether 800 hours, really feel remote unreachable.

Learn in FCC (5)

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.