Home Web Front-end JS Tutorial jQuery effect example sharing

jQuery effect example sharing

Jan 11, 2018 pm 05:09 PM
jquery share Effect

jQuery effect operations are divided into five categories: 1. Basic, 2. Slide, 3. Fade in and out, 4. Customized, 5. Settings. This article will explain this in detail. Has very good reference value. Let's take a look with the editor below, I hope it can help everyone.

Effect operations are divided into five categories: 1. Basic, 2. Sliding, 3. Fade in and out, 4. Customized, 5. Settings

##show ) .show();

                                                                                                                                                                                                  The P tag is displayed. After executing this line of code, P is hidden.

 <p style="display: none">Hello</p>
 <input id="btn1" type="button" value="切换"/>
Copy after login
Bind a click event to the button. When P is real, let it be hidden. If P is hidden, let it be displayed.

Note: show(), displays hidden matching elements.

hide(), hide the displayed elements.

toggle() is used to bind two or more event handler functions to respond to the click event of the selected element in turn.

slideDown(), slideUp(), slideToggle()

The code is as follows:

html code:

 $("#btn1").click(function(){
  $("p").toggle("show");
 })
Copy after login
jQuery code:

 <p></p>
 <input id="btn1" type="button" value="展开"/>
 <input id="btn2" type="button" value="收缩"/>
 <input id="btn3" type="button" value="切换"/>
Copy after login
Bind the click event to the button with ID btn3. When p expands downward, it shrinks upward, and vice versa.

Note: slideDown(), expand downward.

Slide Up(), shrink upward.

     slide Toggle(), switches the visibility of all matching elements through height changes.

The effect is as follows:

##fadeIn(), fadeOut(), fadeTo(), fadeToggle()

The code is as follows:

html code:

 $("#btn1").click(function(){
  $("p").slideDown();
 });
  给id为btn1的按钮绑定click事件,当点击展开按钮的时候,p向下展开。

 $("#btn2").click(function(){
  $("p").slideUp();
 });
  给id为btn2的按钮绑定click事件,当点击展开按钮的时候,p向上收缩。

 $("#btn3").click(function(){
  $("p").slideToggle();
 });
Copy after login
jQuery code:

 <p></p> 
 <input id="btn1" type="button" value="淡入"/>
 <input id="btn2" type="button" value="淡出"/>
 <input id="btn3" type="button" value="切换"/>
 <input id="btn4" type="button" value="设置透明度"/>
Copy after login
Use the selector to select the first input and bind a click event to it. p is hidden at first, and it will be It will be displayed slowly within seconds to achieve the fade-in effect.

 $("input").first().click(function(){
  $("p").fadeIn(1000);
 });
Copy after login
Use the selector to select the second input and bind the click event to it. p is now displayed, and it will slowly hide within one second to achieve the fade-out effect.

 $("input").eq(1).click(function(){
  $("p").stop().fadeOut(1000);
  //$("p").fadeOut(1000);
 });
Copy after login
Use the selector to select the third input, bind a click event to it, and when p is displayed, let it fade out. On the contrary, when p is hidden, let it fade in.
 $("input").eq(2).click(function(){
  $("p").stop().fadeToggle(1000);
 })
Copy after login

Use the selector to select the fourth input, bind a click event to it, and set the fade-in (fade-out) time and transparency.

Note: fadeIn(), achieves the fade-in effect of all matching elements through changes in opacity.

fadeOut(), which achieves the fade-out effect of all matching elements through changes in opacity.

​​​​ fadeTo(), gradually adjusts the opacity of all matching elements to the specified opacity.

fadeToggle(), switches the fade-in and fade-out effects of all matching elements through changes in opacity.

The effect is as follows:

##animate(), stop(), delay()

The code is as follows:

css code:

 $("input").eq(3).click(function(){
  $("p").stop().fadeTo(1000,0.5);
 })
Copy after login

html code:

 p{
 width:100px;
 height:100px;
 background:red;
 }
Copy after login

jQuery code:

 <p>ST宋泽</p>
 <input id="btn1" type="button" value="显示效果"/>
 <input id="btn2" type="button" value="停止动画"/>
Copy after login

Bind the click event to the button with id btn1. When the button is clicked, delay it for two seconds. The width, height, and font-size of p will

gradually change to the set values, and "Animation Complete" will be printed after two seconds.

 $("#btn1").click(function(){
  $("p").delay(2000).animate({
  "width":"300px",
  "height":"300px",
  "font-size":"4em"
  },5000,function(){
  console.log("动画完成")
  })
 });
Copy after login
Bind the click event to the button with ID btn2. When p is doing animation, click the button and the animation will stop.

Note: animate(), a function used to create custom animations.

stop(), stops all animations running on the specified element.

delay(), set a delay to delay the execution of subsequent items in the queue.

The effect is as follows:

jQuery.fx.off, jQuery.fx.interval

jQuery.fx.off, close the page All animations.

jQuery.fx.interval, set the display frame rate of animation.

Related recommendations:

Share a jQuery effect example code

HTML5 production imitation jQuery effect

Jquery Effect Collection: Creating Computer Health Examination Score Special Effects with Source Code Download_jquery

The above is the detailed content of jQuery effect example sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Users encounter rare glitches: Samsung Watch smartwatches suddenly experience white screen issues Users encounter rare glitches: Samsung Watch smartwatches suddenly experience white screen issues Apr 03, 2024 am 08:13 AM

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

How to share Quark Netdisk to Baidu Netdisk? How to share Quark Netdisk to Baidu Netdisk? Mar 14, 2024 pm 04:40 PM

Quark Netdisk and Baidu Netdisk are very convenient storage tools. Many users are asking whether these two softwares are interoperable? How to share Quark Netdisk to Baidu Netdisk? Let this site introduce to users in detail how to save Quark network disk files to Baidu network disk. How to save files from Quark Network Disk to Baidu Network Disk Method 1. If you want to know how to transfer files from Quark Network Disk to Baidu Network Disk, first download the files that need to be saved on Quark Network Disk, and then open the Baidu Network Disk client. , select the folder where the compressed file is to be saved, and double-click to open the folder. 2. After opening the folder, click "Upload" in the upper left corner of the window. 3. Find the compressed file that needs to be uploaded on your computer and click to select it.

How to share NetEase Cloud Music to WeChat Moments_Tutorial on sharing NetEase Cloud Music to WeChat Moments How to share NetEase Cloud Music to WeChat Moments_Tutorial on sharing NetEase Cloud Music to WeChat Moments Mar 25, 2024 am 11:41 AM

1. First, we enter NetEase Cloud Music, and then click on the software homepage interface to enter the song playback interface. 2. Then in the song playback interface, find the sharing function button in the upper right corner, as shown in the red box in the figure below, click to select the sharing channel; in the sharing channel, click the &quot;Share to&quot; option at the bottom, and then select the first &quot;WeChat Moments&quot; allows you to share content to WeChat Moments.

Kyushu Fengshen Assassin 4S Radiator Review Air-cooled 'Assassin Master' Style Kyushu Fengshen Assassin 4S Radiator Review Air-cooled 'Assassin Master' Style Mar 28, 2024 am 11:11 AM

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

How to share files with friends on Baidu Netdisk How to share files with friends on Baidu Netdisk Mar 25, 2024 pm 06:52 PM

Recently, Baidu Netdisk Android client has ushered in a new version 8.0.0. This version not only brings many changes, but also adds many practical functions. Among them, the most eye-catching is the enhancement of the folder sharing function. Now, users can easily invite friends to join and share important files in work and life, achieving more convenient collaboration and sharing. So how do you share the files you need to share with your friends? Below, the editor of this site will give you a detailed introduction. I hope it can help you! 1) Open Baidu Cloud APP, first click to select the relevant folder on the homepage, and then click the [...] icon in the upper right corner of the interface; (as shown below) 2) Then click [+] in the &quot;Shared Members&quot; column 】, and finally check all

Easily understand 4K HD images! This large multi-modal model automatically analyzes the content of web posters, making it very convenient for workers. Easily understand 4K HD images! This large multi-modal model automatically analyzes the content of web posters, making it very convenient for workers. Apr 23, 2024 am 08:04 AM

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

Huntkey MX750P full module power supply review: 750W of concentrated platinum strength Huntkey MX750P full module power supply review: 750W of concentrated platinum strength Mar 28, 2024 pm 03:20 PM

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.

Exquisite light and shadow art in spring, Haqu H2 is the cost-effective choice Exquisite light and shadow art in spring, Haqu H2 is the cost-effective choice Apr 17, 2024 pm 05:07 PM

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

See all articles