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 to hide the picture after how many seconds with jquery?

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to hide the picture after how many seconds after jquery". In the daily operation, I believe that many people have doubts about how to hide the picture after how many seconds after jquery. The editor consulted all kinds of information and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the question of "how to hide the picture in how many seconds after jquery". Next, please follow the editor to study!

Implementation method: 1, with "$(" img "). Delay (milliseconds). FadeOut ()" statement, delay () sets the delay seconds; 2, with "setTimeout (function () {$(" img "). Hide ();}, millisecond value);" statement, through the timer to delay.

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

Sometimes the page needs to add some dynamic effects, using a delay of a few seconds to hide the picture and disappear after displaying the specified number of seconds. Here we show you how to use the jQuery setting to specify the number of seconds (5 seconds) to hide the picture.

Method 1: use the .delay () method

Sets the img picture to be hidden after 5 seconds of display.

$(document) .ready (function () {$("button") .click (function () {$("img"). Delay (5000). FadeOut ();})

Hide the picture after 5 seconds

Method 2: use the setTimeout () method

Use setTimeout () to set a timer to hide the picture after 5 seconds of display.

$(document) .ready (function () {$("button") .click (function () {setTimeout (function () {$("img"). Hide ();}, 5000);});})

Hide the picture after 5 seconds

At this point, the study of "how to hide the picture in how many seconds after jquery" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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