JQuery's animate Function Learning Record, jqueryanimate Function
I was very interested in implementing jQuery animate a long time ago, but I was very busy some time ago. I didn't have time to study it until the last day of the Dragon Boat Festival holiday.
Each animation transition effect of jQuery. animate is implemented through the easing function. Two such fu
The usage and precautions of animate in jQuery, jqueryanimate
I. animate syntax structure
animate(params,speed,callback)
Params: A ing that includes style attributes and values, such{key1:value1,key2:value2}
Speed: speed parameter [Optional]
Callback: function executed when the animation is completed [Optional]
Ii. Custom simple animation
A simple example is used
CSS property values are gradually changed, so you can create animation effects.Only numeric values can create animations (such as "margin:30px").String values cannot create animations (such as "background-color:red").
Copy Code code as follows:
$ (' #shang '). Click (function () {$ (' html,body '). Animate ({scrolltop: ' 0px '}, 800);});
The code above indicates that the scroll bar jumps to 0, and the page moves at 800.
Combined with
Before today, I still focused on the most common usage of the animate () method in jQuery. I checked the manual and found that several useful callback functions were added at 1.8, let's take a look at the usage and precautions of animate in jQuery, so that you can refer to it when you need it. Let's take a look at it. I. animate syntax structure
When writing your own project encountered such an effect, the left menu button click on the pop-up menu, the menu button becomes X-shaped. (Reference keyword: Burger button http://www.htmleaf.com/Demo/201506232094.html)This is probably the animation effect in the GIF below:The approximate animation effect is as follows1. First horizontal line (DIV) rotate-45deg2. The second horizontal line disappears gradually3. Third horizontal line rotate 45degLike the previous link in the pure CSS3 implementa
The function used to create the custom animation.return value: JQuery animate (params, [duration], [easing], [callback])If you are using a string value such as "Hide," "Show," or "toggle," the default animated form is called for the property. Paramsoptions a group of packagesContains a collection of style attributes and their values as animated and final valuesParams object {}, note: All specified properties must be in camel form, for example with Mar
The use of anchor points for the jump in the page is indeed very convenient, but to increase the effect of the Web page, you can use the animate in jquery, to achieve a scrolling action, slowly scrolling to where you want to jump to the position, which will look very tall.
Scroll to the top:
Copy Code code as follows:
$ ('. Scroll_top '). Click (function () {$ (' html,body '). Animate ({scr
Edge Animate is Adobe's latest visualization tool for making HTML5 animations. It can be simply understood as the HTML5 Flash Pro. In subsequent articles, I will introduce this new HTML5 animation artifact one by one. This article first describes how to embed HTML5 animations created by Edge Animate into Wordpress.
1. Download Adobe Edge Animate production tool
A
I. Grammatical structure of animate
Animate (Params,speed,callback)
Params: A mapping that contains style attributes and values, such as{key1:value1,key2:value2}
Speed: Speed parameter [optional]
Callback: Functions that are executed when the animation completes [optional]
Two, custom simple animation
Use a simple example to illustrate the effect of clicking a div across the page.
The function used to create the custom animation.return value: JQuery animate (params, [duration], [easing], [callback])If you are using a string value such as "Hide," "Show," or "toggle," the default animated form is called for the property. Paramsoptions a group of packagesContains a collection of style attributes and their values as animated and final valuesParams object {}, note: All specified properties must be in camel form, for example with Mar
It turned out to be good. Why don't you go ahead and write it down.
This version is basically the same as jquery's animate.
I mean, the effect is basically the same. (efficiency has not been tested.) );
If a professional tester helps me with the test.
1: Function description
Compatible with mainstream browsers.
1: Support callback function;
2: Support level linkage drawing call;
3: Support delay animation queue delay;
4: Support stop stop animation;
5
A page with a button that goes back to the top, click on the page will automatically return to the top of the page, you can use the way of hyperlinks, but the instant return to the top of the effect is not very ideal, the better effect is to scroll up for about 0.5 seconds, which requires the animation effect.
I chose to use jquery's animate () method, the top effect is perfect, but another effect is not ideal.
I want the height of the top button to d
This example describes the use of the Animate () method in jquery. Share to everyone for your reference. The specific analysis is as follows:
This method is used to create custom animations and to specify the length and erase effects of animations. You can also trigger a callback function when the animation is complete.
Use of the Animate () method:
Mode one:
defines the animation termination style prop
To share with you today a small example of sliding switching effect with animate
We all know that jquery provides a few ways to achieve sliding effects:
1.slideDown ()2.slideUp ()3.slideToggle ()
But the above slide is not easy to control the direction of its slide, so we have to write a bar ourselves ...
The code is as follows:
The above code can achieve a complete sliding effect. But one thing to be aware of,
As shown above, the need
Yesterday, a classmate to me for help, said to do a simple animation effect, is the picture automatically play around
Copy Code code as follows:
var _left = 770;
var left =-_left;//-770
function slideimg () {
if (left = = -3080 | | left = = 0) {
_left =-_left;
}
$ ('. Slidepics '). Animate ({' Left ': Left + ' px '},1000);
left = left-_left;
Tim = settimeout (slideimg,5000);
}
Slideimg ();
Copy Code c
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.