Home Web Front-end JS Tutorial How to make DIV disappear or display after delaying for a few seconds in JS/jQuery

How to make DIV disappear or display after delaying for a few seconds in JS/jQuery

Jun 06, 2018 am 10:07 AM
div jquery js delay show disappear

This article mainly introduces the method of JS/jQuery to realize p to disappear or display after a delay of a few seconds. It analyzes the related operation skills of javascript using setTimeout and jQuery using delay method to realize delayed display function in the form of examples. Friends who need it You can refer to the following

The example of this article describes how JS/jQuery implements the method of p disappearing or displaying after a delay of a few seconds. Share it with everyone for your reference, the details are as follows:

1. The most commonly used method (setTimeout):

<script language=&#39;javascript&#39; type=&#39;text/javascript&#39;>
$(function () {
 setTimeout(function () {
  $("pid").show();
 }, 6000);
})
</script>
Copy after login

2. The second method (delay

jquery makes a p disappear with a delay, pure jQuery, no need for settimeout, just use jQuery to write it.

<script language=&#39;javascript&#39; type=&#39;text/javascript&#39;>
$(document).ready(
 function()
 {
  /**
  *1.delay函数是jquery 1.4.2新增的函数
  *2.hide函数里必须放一个0,不然延时不起作用
  */
  $(&#39;#pid&#39;).delay(6000).hide(0);
 }
);
</script>
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Package and load files to the specified location in webpack (detailed tutorial)

In vue2.0 Making a breadcrumb navigation bar through elementUI

Package js map file in webpack (detailed tutorial)

The above is the detailed content of How to make DIV disappear or display after delaying for a few seconds in JS/jQuery. 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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Recommended: Excellent JS open source face detection and recognition project Recommended: Excellent JS open source face detection and recognition project Apr 03, 2024 am 11:55 AM

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages ​​and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to use PUT request method in jQuery? How to use PUT request method in jQuery? Feb 28, 2024 pm 03:12 PM

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

jQuery Tips: Quickly modify the text of all a tags on the page jQuery Tips: Quickly modify the text of all a tags on the page Feb 28, 2024 pm 09:06 PM

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

The relationship between js and vue The relationship between js and vue Mar 11, 2024 pm 05:21 PM

The relationship between js and vue: 1. JS as the cornerstone of Web development; 2. The rise of Vue.js as a front-end framework; 3. The complementary relationship between JS and Vue; 4. The practical application of JS and Vue.

Use jQuery to modify the text content of all a tags Use jQuery to modify the text content of all a tags Feb 28, 2024 pm 05:42 PM

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:

Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Samsung will provide displays for Microsoft's MR headsets, and the devices are expected to be lighter and have clearer displays Aug 10, 2024 pm 09:45 PM

Recently, Samsung Display and Microsoft signed an important cooperation agreement. According to the agreement, Samsung Display will develop and supply hundreds of thousands of OLEDoS panels for mixed reality (MR) head-mounted devices to Microsoft. Microsoft is developing an MR device for multimedia content such as games and movies. This device is expected to It will be launched after the OLEDoS specifications are finalized, mainly serving the commercial field, and is expected to be delivered as early as 2026. OLEDoS (OLED on Silicon) technology OLEDoS is a new display technology that deposits OLED on a silicon substrate. Compared with traditional glass substrates, it is thinner and has higher pixels. OLEDoS display and ordinary display

How will she survive when the super-brain detective disappears? How will she survive when the super-brain detective disappears? Mar 07, 2024 pm 12:49 PM

The Super Brain Detective game is a mobile game that solves puzzles. The game screen is simple and fresh. In the game, we need to constantly use our brains to find the real answers in the game. This is still very important. I will bring you the disappearance of her. After reading the specific guide for this level, you will gain a lot, which is still very good. Strategy for clearing the level of Super Brain Detective: Her Disappearance 1. The young lady fell while she was trying on clothes. 2. The child’s hand reached out and there were bruises, bare feet, and pale skin. 3. The second one is a man’s hand, wearing black leather shoes, with scars and tattoos. 4. The third one is the hand of an old woman, with a green object on her hand, blood marks on her arm, and a rope. 5. Then drag your hand over. 6. Then you can leave with the rope.

What is the difference between full-width characters and half-width characters? What is the difference between full-width characters and half-width characters? Mar 25, 2024 pm 03:54 PM

What is the difference between full-width characters and half-width characters? In our daily life, we often encounter the two concepts of full-width characters and half-width characters, especially in input methods, typesetting, printing, etc., which involve the use of these two characters. So, what is the difference between full-width characters and half-width characters? Let us discuss this issue below. First of all, full-width characters and half-width characters were concepts originally introduced by Chinese typewriters. The so-called half-width characters are characters that occupy half the width of a character, usually referring to English characters and Arabic numerals. Full-width characters occupy

See all articles