Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How jquery makes elements disappear slowly

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how jquery makes elements disappear slowly", the content is simple and easy to understand, and the organization is clear. I hope it can help you solve your doubts. Let Xiaobian lead you to study and learn this article "how jquery makes elements disappear slowly".

In jquery, you can use fadeOut() method to make elements disappear slowly. This method is used to gradually change the opacity of the selected element. You can gradually hide the element. Set parameters to set the speed at which the element disappears. The syntax is "element object.fadeOut(speed, speed of elements at different points, parameters executed after execution)".

Operating environment for this tutorial: Windows 10 system, jquery version 3.2.1, Dell G3 computer.

jquery How to make elements disappear slowly

In jquery, by getting the image object, use the fadeOut() method to make the image disappear slowly.

Create a new html file called test.html that explains how jquery makes images disappear slowly. Inside the p tag, use the img tag to create an image, which you'll use the jquery method to make disappear. Set the id attribute of img tag to mypic, mainly used to obtain img object through this id.

Use the button tab to create a button with the name "Picture disappears slowly." Binds an onclick event to the button, and when the button is clicked, executes the himg () function. Create the himg() function, in the function, get the image object by id(mypic), use the fadeOut() method to set it to slow, you can achieve the image slowly disappear.

Open the test.html file in your browser and click on the button to see how it works.

Summary:

Create a test.html file.

2. In the file, in the p tag, use the img tag to create an image and create a button to trigger the execution of the js function.

3, in the js tag, create a function, in the function, by obtaining the image object, use fadeOut() method set to slow, you can achieve the image slowly disappear.

precautions

The fadeOut () method parameter can be slow or the number of seconds the image disappears in milliseconds.

That's all for "how jquery makes elements disappear slowly." Thanks for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report