jQuery simple animation effect
1. show() displays animation
Syntax: show(speed,callback) Number/String, Function speed is the animation execution time, The unit is milliseconds. It can also be slow", "normal", "fast" callback is optional and is a function executed when the animation is completed.
show(speed,[easing],callback)Number/ String easing defaults to swing (easing animation, gradually getting faster as the animation begins), optional linear (steady animation, each frame is the same rate);
("#p1").show(3000,function(){ alert("Animation display completed!"); });
2. hide() hidden effect
## Syntax: hide(speed,callback) Number/String,Function
hide(speed,easing,callback) Number/String parameters are the same as the parameter types and definitions of show. Please refer to show
## $("#p1").hide( 3000,function(){ alert("Animation hiding completed") });
##3.toggle () Hide and display automatically switch. When it is currently displayed, it is hidden. When it is currently hidden, it is displayed ## Syntax: toggle(speed,callback) Number/String, Function
## toggle(speed,callback) Number/String,String,Function
## $("#p1").toggle(3000, function(){ alert("Animation effect switching completed") });
##4. slideDown( ) displays downwards, slow() expands horizontally and vertically at the same time, while slideDown only expands downwards in the vertical direction
Syntax: slideDown(speed, callback) Number/String,Function slideDown(speed,[easing],callback) Number/String,Function
## $("# p1").slideDown(3000,function(){ alert("Expand downward display successfully!"); });
5. slideUp() hides upwards. hide() operates in both horizontal and vertical directions, while slideUp() only hides upwards in the vertical direction
Syntax: slideUp(speed,callback) Number/String,Function slideUp(speed,[easing],callback) Number/String,String,Function
$("#p1").slideUp(3000,function(){ alert("Successfully hidden up!"); })
6. SlideToggle switches in the vertical direction. The toggle is in both horizontal and vertical directions, while the slideToggle is only in the vertical direction.
Syntax: slideToggle(speed,callback) Number/String,Function
## slideToggle(speed,[easing],callback) Number/String,String,Function
## $("#p1").slideToggle(3000,function(){ alert("Horizontal switching successful"); });
7. fadeIn() changes the transparency to display
Syntax: fadeIn(speed,callback) Number/String,Function
fadeIn(speed,[easing],callback) Number/String,Function $("#p1").FadeIn(3000,function(){ alert ("Fade in successfully!"); }); 8. fadeOut() to change transparency To hide Syntax: fadeOut(speed,callback) Number/String,Function fadeOut(speed,[ easing],callcack) Number/String,String,Function ## $("#p1").fadeOut(3000,function(){ alert("Fade out and hide successfully!"); });
##9. fadeToggle() changes the transparency to switch the display and hidden state fadeToggle(speed,[easing],callback) Number /String,Function $("#p1").fadeToggle(3000,function(){ alert("Fade switch successful!"); }); ##10. fadeTo() changes the transparency to the specified transparency at the specified time Syntax: fadeTo(speed,callback) Number/String,Function fadeTo([speed],opacity,[easing],[fn]) Number/String,Float ,String,Function,opacity means that the transparency value is from 0-1 $("#p1").fadeTo(3000,0.22,function(){ alert("Transparency changed Success!"); });
11. animate() Custom animation, generally speaking Digital changes can be used for animation. Syntax: animate(params,speed,easing,callback); Style parameters, time, optional, function $("#p1").animate({width:300px,height,300px},3000); appropriatelygene Numbery, the params should be enclosed in square brackets, and you can use css Style parameters. Be careful to use the camel rule, for example, font-size should be written as fontSize. Color gradients are not supported. backgroundPosition 12. stop() stops Execute animation ## Stop([clearQueue],[gotoEnd]); Both parameters are Boolean values. The first one indicates whether to stop animation execution. The two represent, if stopped, whether it will immediately change to the state of completion of execution. If set to no, it will stay in the state of half execution. $("#p1").hide(5000) //This animation is being executed $("#p1"). stop(); //The animation specified in the previous line of code stops in half state $("#p1").stop(true,true); //Stop the current animation and at the same time The animation switches to the completed execution state. 13. delay() delays the execution of animation. When an animation stops(), you can still use delay. () to delay execution. Execution continues where it left off. Of course, it is not possible to continue execution using the original method, but there is no delay effect. 14. jQuery.fx.off //This property is only whether to turn off the animation on the current page. After turning off the animation, there will be no animation effect. All animations with execution time set will be completed instantly. . Note where this attribute appears. Different locations have different effects. $(function(){ jQuery.fx.off = true; //Property outside the event , valid for all animations executed after the page is loaded $("#p1").click(function(){ //If the attribute is written here, it will only be invalid for the current click event , does not affect the animation of other events ## $("#p1").hide(3000); //Note that since jQuery.fx.off is set to true, it expires in 3000 milliseconds. Equivalent to hide(); }); 15. jQuery.fx.interval //This property sets the frame rate of the animation in milliseconds. The smaller the time, the smoother it will be. , the position where the attribute appears also affects the range ## $(function(){ jQuery.fx.interval = 1000; $("#p1").click(function(){ ## $("#p1").hide (3000); //jQuery.fx.interval is set to 1000, which is 1 second, and the effect is changed once. ## }); }) The above is my simple understanding of some basic animations of jq. I have made some accumulation here. I also hope to help compatriots who have just come into contact with jq. I hope it can be of some help to you. If there is anything that needs to be added, I will add it one by one in the following time. I also hope that the experts can actively put forward any suggestions they have.
borderWidth
borderBottomWidth
borderLeftWidth
borderRightWidth
borderTopWidth
borderSpacing
margin
marginBottom
marginLeft
marginRight
marginTop
outlineWidth
padding
paddingBottom
paddingLeft
paddingRight
paddingTop
height
width
maxHeight
maxWidth
minHeight
maxWidth
font
fontSize
bottom
left
right
top
letterSpacing
wordSpacing
lineHeight
textIndent
The above is the detailed content of jQuery simple animation effect. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You may have encountered the problem of green lines appearing on the screen of your smartphone. Even if you have never seen it, you must have seen related pictures on the Internet. So, have you ever encountered a situation where the smart watch screen turns white? On April 2, CNMO learned from foreign media that a Reddit user shared a picture on the social platform, showing the screen of the Samsung Watch series smart watches turning white. The user wrote: "I was charging when I left, and when I came back, it was like this. I tried to restart, but the screen was still like this during the restart process." Samsung Watch smart watch screen turned white. The Reddit user did not specify the smart watch. Specific model. However, judging from the picture, it should be Samsung Watch5. Previously, another Reddit user also reported

Speaking of ASSASSIN, I believe players will definitely think of the master assassins in "Assassin's Creed". They are not only skilled, but also have the creed of "devoting themselves to the darkness and serving the light". The ASSASSIN series of flagship air-cooled radiators from the appliance brand DeepCool coincide with each other. Recently, the latest product of this series, ASSASSIN4S, has been launched. "Assassin in Suit, Advanced" brings a new air-cooling experience to advanced players. The appearance is full of details. The Assassin 4S radiator adopts a double tower structure + a single fan built-in design. The outside is covered with a cube-shaped fairing, which has a strong overall sense. It is available in white and black colors to meet different colors. Tie

With the arrival of spring, everything revives and everything is full of vitality and vitality. In this beautiful season, how to add a touch of color to your home life? Haqu H2 projector, with its exquisite design and super cost-effectiveness, has become an indispensable beauty in this spring. This H2 projector is compact yet stylish. Whether placed on the TV cabinet in the living room or next to the bedside table in the bedroom, it can become a beautiful landscape. Its body is made of milky white matte texture. This design not only makes the projector look more advanced, but also increases the comfort of the touch. The beige leather-like material adds a touch of warmth and elegance to the overall appearance. This combination of colors and materials not only conforms to the aesthetic trend of modern homes, but also can be integrated into

With its compact size, the ITX platform has attracted many players who pursue the ultimate and unique beauty. With the improvement of manufacturing processes and technological advancements, both Intel's 14th generation Core and RTX40 series graphics cards can exert their strength on the ITX platform, and gamers also There are higher requirements for SFX power supply. Game enthusiast Huntkey has launched a new MX series power supply. In the ITX platform that meets high-performance requirements, the MX750P full-module power supply has a rated power of up to 750W and has passed 80PLUS platinum level certification. Below we bring the evaluation of this power supply. Huntkey MX750P full-module power supply adopts a simple and fashionable design concept. There are two black and white models for players to choose from. Both use matte surface treatment and have a good texture with silver gray and red fonts.

In the current era of rapid technological development, laptops have become an indispensable and important tool in people's daily life and work. For those players who have high performance requirements, a laptop with powerful configuration and excellent performance can meet their hard-core needs. With its excellent performance and stunning design, the Colorful Hidden Star P15 notebook computer has become the leader of the future and can be called a model of hard-core notebooks. Colorful Hidden Star P1524 is equipped with a 13th generation Intel Core i7 processor and RTX4060Laptop GPU. It adopts a more fashionable spaceship design style and has excellent performance in details. Let us first take a look at the features of this notebook. Supreme equipped with Intel Core i7-13620H processing

A large model that can automatically analyze the content of PDFs, web pages, posters, and Excel charts is not too convenient for workers. The InternLM-XComposer2-4KHD (abbreviated as IXC2-4KHD) model proposed by Shanghai AILab, the Chinese University of Hong Kong and other research institutions makes this a reality. Compared with other multi-modal large models that have a resolution limit of no more than 1500x1500, this work increases the maximum input image of multi-modal large models to more than 4K (3840x1600) resolution, and supports any aspect ratio and 336 pixels to 4K Dynamic resolution changes. Three days after its release, the model topped the HuggingFace visual question answering model popularity list. Easy to handle

Many photography enthusiasts like to use lenses. Their shooting needs are very changeable, so when it comes to lens selection, they prefer a more versatile product, which is what we commonly call "one lens to conquer the world" lens. It just so happens that Nikon has launched a new product, the NIKKOR Z28-400mmf/4-8VR lens, a true "one lens that can conquer the world" lens. The lens covers from the 28mm wide-angle end to the 400mm telephoto end. Equipped with its Z-mount camera, it can easily shoot a very rich range of photography themes and bring about a rich change of perspective. Today, we will talk to you about this NIKKOR Z28-400mmf/4-8VR lens through our recent use experience. NIKKOR Z28-400mmf/4-8VR is

Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: <
