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='javascript' type='text/javascript'> $(function () { setTimeout(function () { $("pid").show(); }, 6000); }) </script>
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='javascript' type='text/javascript'> $(document).ready( function() { /** *1.delay函数是jquery 1.4.2新增的函数 *2.hide函数里必须放一个0,不然延时不起作用 */ $('#pid').delay(6000).hide(0); } ); </script>
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!