Home>Article>Web Front-end> How to set jquery to stop for a few seconds

How to set jquery to stop for a few seconds

Christopher Nolan
Christopher Nolan Original
2022-05-18 15:47:49 2563browse

In jquery, you can use the setTimeout() method to set a few seconds to stop before executing. This method is used to set a specified waiting time. When the time is up, a specified code will be executed. Syntax is "setTimeout(code to be executed, number of milliseconds to stop)".

How to set jquery to stop for a few seconds

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

How to set jquery to stop for a few seconds

setTimeout() is a method belonging to window. This method is used to call a function or calculate an expression after the specified number of milliseconds

Syntax The format can be the following two:

setTimeout(要执行的代码, 等待的毫秒数) setTimeout(JavaScript 函数, 等待的毫秒数)

setTimeout() is to set a specified waiting time (unit is one thousandth of a second, millisecond). When the time is up, the browser will execute a specified code

Examples are as follows:

     

这是标题

这是一个段落。

这是一个段落。

这是一个段落。

Output results:

How to set jquery to stop for a few seconds

Related video tutorial recommendations:jQuery video tutorial

The above is the detailed content of How to set jquery to stop for a few seconds. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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