Example tutorial on animation in jquery
jQuery Animation
1. Zoom effect in the upper left corner
hide([speed,[fn]])
Overview: Hide the displayed elements
Parameters: speed: a string of one of three predetermined speeds ("slow", "normal", or "fast") or a millisecond value indicating the duration of the animation (such as: 1000)
fn: in Function to be executed when the animation completes, once per element.
// $(":button[value=hide]").click(function(){
// $("div").hide(2000,function(){
// alert("div is hidden");
// });
// })
show([speed,[fn]])
Overview: Show hidden matching elements.
// $(":button[value=show]").click(function(){
// $("div").show(2000,function(){
// alert("div is displayed");
// });
// })
toggle([speed],[fn])
Overview: If the element is visible, switch it to hidden; if the element is hidden, switch it to visible.
// //toggle([speed],[fn]) If the element is visible, switch to hidden; if the element is hidden, switch to visible
// $(": button[value=hidden]").click(function(){
// $("div").toggle(2000);
// })
2. Up and down scaling effect
slideUp(speed, [callback])
Overview: Dynamically hide all matches by changing height (decreasing upward) element, optionally triggering a callback function after hiding is completed.
Parameters: speed A string of one of three predetermined speeds ("slow", "normal", or "fast") or a millisecond value indicating the animation duration (such as: 1000) callback (optional) in The function executed when the animation is completed
//slideUp(speed, [fn]) dynamically hides all matching elements through height changes (decreasing upwards), and optionally triggers a callback function after the hiding is completed
// $(":button[value=hidden]").click(function(){
// $("div").slideUp(2000);
// })
slideDown(speed, [callback])
Overview: Dynamically display all matching elements through height changes (increase downward), and optionally trigger a callback function after the display is completed.
// //slideDown(speed, [fn]) Dynamically displays all matching elements through height changes (increasing downward), and optionally triggers a callback function after the display is completed
// $(":button[value=display]").click(function(){
// $("div").slideDown(2000);
// })
slideToggle([speed],[fn])
Overview: Toggle the visibility of all matching elements through height changes, and optionally trigger a callback function after the switch is completed.
//slideToggle([speed],[fn]) Toggles the visibility of all matching elements through height changes, and optionally triggers a callback function after the switch is completed
// $(" :button[value=hidden]").click(function(){
// $("div").slideToggle(2000);
// })
3. Fade effect (change in opacity)
fadeOut(speed, [callback])
Overview: All are achieved through changes in opacity Matches the element's fade-out effect and optionally triggers a callback function after the animation completes.
// $(":button[value=hide]").click(function(){
// $("div").fadeOut(2000);
// } )
fadeIn(speed, [callback])
Overview: Achieve the fade-in effect of all matching elements through changes in opacity, and optionally trigger a callback function after the animation is completed.
$(":button[value=display]").click(function(){
// $("div").fadeIn(2000);
// })
fadeToggle([speed,[fn]])
Overview: Switch the fade-in and fade-out effects of all matching elements through changes in opacity, and optionally trigger a callback after the animation is completed function.
$(":button[value=hidden]").click(function(){
// $("div").fadeToggle(2000);
// })
fadeTo(speed,opacity,[fn])
Overview: Progressively adjust the opacity of all matching elements to the specified opacity, and optionally trigger after the animation is completed A callback function.
// $(":button[value=Hide]").click(function(){
// $("div").fadeTo(2000,0.5);
/ / })
4. Custom animation
animate(params,[speed],[fn])
Overview: Functions for creating custom animations.
// $("div").animate({"left":"1000px"},2000);
stop([clearQueue], [gotoEnd ])
Overview: Stop all animations running on the specified element.
Parameters: clearQueue (optional) If set to true, the queue will be cleared. Animation can be ended immediately.
Series Gotond (optional) allows the currently executed animation to be completed immediately.
// $(document).click(function(){
// $("div").stop()
// })
delay(duration)
Overview: Set a delay to delay the execution of subsequent items in the queue.
Parameter duration delay time, unit: milliseconds
// $("div").delay(2000).animate({"left":"1000px"},2000);
The above is the detailed content of Example tutorial on animation in jquery. 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



We often use ppt in our daily work, so are you familiar with every operating function in ppt? For example: How to set animation effects in ppt, how to set switching effects, and what is the effect duration of each animation? Can each slide play automatically, enter and then exit the ppt animation, etc. In this issue, I will first share with you the specific steps of entering and then exiting the ppt animation. It is below. Friends, come and take a look. Look! 1. First, we open ppt on the computer, click outside the text box to select the text box (as shown in the red circle in the figure below). 2. Then, click [Animation] in the menu bar and select the [Erase] effect (as shown in the red circle in the figure). 3. Next, click [

Detailed explanation of jQuery reference method: Quick start guide jQuery is a popular JavaScript library that is widely used in website development. It simplifies JavaScript programming and provides developers with rich functions and features. This article will introduce jQuery's reference method in detail and provide specific code examples to help readers get started quickly. Introducing jQuery First, we need to introduce the jQuery library into the HTML file. It can be introduced through a CDN link or downloaded

How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

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: <

Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

Sometimes we encounter the need to add animation to a ppt. For example, if we want to make a thunderstorm ppt and add some animated thunderstorm effects to it, what should we do? Today, the editor will introduce to you how to make an animated thunderstorm in thunderstorm ppt. It is actually very simple, come and learn it! 1. First we open a PPT page, "Insert" - "Shape" - "Basic Shape" - "Lightning Shape", as shown in the picture. 2. In the "Fill and Line" tab on the right, select "Fill": white; "Select" "Line": black, as shown in the figure. 3. Click "Animation" - "Custom Animation" - "Add Effects" - "Emphasis" - "Subtle" - "Flickering",

How to tell if a jQuery element has a specific attribute? When using jQuery to operate DOM elements, you often encounter situations where you need to determine whether an element has a specific attribute. In this case, we can easily implement this function with the help of the methods provided by jQuery. The following will introduce two commonly used methods to determine whether a jQuery element has specific attributes, and attach specific code examples. Method 1: Use the attr() method and typeof operator // to determine whether the element has a specific attribute
