JQuery animation and special effects, JQuery animation Special Effects

Source: Internet
Author: User

JQuery animation and special effects, JQuery animation Special Effects

Show and hide

Show (spped, [callback]) and hide (spped, [callback])

The speed options include slow, normal, and fast. The corresponding speed is 600 ms, 400 ms, and 200 ms respectively. You can also enter the number of milliseconds. The callback function is the callback function, which is called after the action is completed.

$("img").show(3000,function(){      $(this).css("border","solid 1px #ccc”);});


Toggle () function, no parameter format, switching between display and hide

Toggle (true orfalse) is in the Boolean format. If it is true, the element is displayed. Otherwise, the element is hidden.

Toggle (speed, [callback]) is similar to the show () function.

Slide

SlideDown (spped, [callback]) and slideUp (spped, [callback])

Essentially, it changes the height of an element.

SlideToglge (spped, [callback]) Switch slide Effect

Fade in and out

FadeIn (spped, [callback]) and fadeOut (spped, [callback])

Essentially, it changes the transparency of elements.

FadeTo (spped, opacity, [callback]); opacity is transparency, between 0 and 1, and 1 is completely transparent

Custom Animation

Animate (params, [duration], [easing], [callback])

Params indicates the attribute styles and worthy sets used to make the animation effect.

Duration indicates three default speed characters, slow, normal, fast, or custom millisecond count

Easing is used as an animation plug-in to control the animation performance. It usually has linear and swing character values.

Callback Function executed after the callback is completed

$ (This ). animate ({width: "20%", height: "70px"}, // Object Notation, which is commonly used in JQuery to pass Parameters 3000, function () {detail (this).css ("border ": "solid 3px #666 "). html ("Bigger !! ") ;}); // When passing parameters, you must use the camel method to write the attribute name. For example, font-size must be written as fontSize.

 

$ ("P"). animate ({left: "20px", top: "70px"}, 3000) // move 20 pixels to the right and 70 pixels down

Stop ([clearQueue], [gotoEnd])

ClearQueue is a Boolean value indicating whether to stop an animation being executed.

GotoEnd is a Boolean value that indicates whether an animation is being executed immediately.

Delay (duration, [queueName])

Duration is the delay time value.

QueueName indicates the queue term, that is, the animation queue.

$ ("A: eq (0 )"). click (function () {$ ("img "). slideToggle (3000) ;}); // change the image by using the "curtain pulling" method $ ("a: eq (1 )"). click (function () {$ ("img "). stop () ;}); // stop an animation in progress $ ("a: eq (2 )"). click (function () {$ ("img "). delay( 2000 ). slideToggle (3000) ;}); // delay switching Image


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.