Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make jquery disappear in two seconds

Shulou Source: shulou.com Published: 2022-06-02 03:32:42 10月01日 Update

In this article, the editor introduces in detail "how jquery disappears in two seconds". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to achieve jquery disappears in two seconds" can help you solve your doubts.

In jquery, you can use the delay () and hide () functions to say that the element disappears after two seconds, the delay () function is used to set the delay time for the execution of the next item in the queue, and the hide () function is used to hide the selected element. The syntax is "$(element) .delay (2000) .hide (200)".

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

How to make jquery disappear in two seconds

The delay () method sets the delay for the execution of the next item in the queue.

Grammar

$(selector) .delay (speed,queueName)

Parameters.

Speed is optional. Set the speed of delay. Possible values: millisecond, "slow", "fast"

QueueName is optional. Specifies the name of the queue. The default is "fx", the standard effects queue.

The hide () method hides the selected element.

Tip: this is similar to the CSS property display:none.

Note: hidden elements are not fully displayed (no longer affect the layout of the page).

Tip: to show hidden elements, check the show () method.

Grammar

$(selector) .hide (speed,easing,callback)

Examples are as follows:

Click (function () {$("# dianji") .click (function () {$("# disappare"). Delay (2000) .hide;})

It will disappear automatically after clicking for 2 seconds.

Output result:

After reading this, the article "how to achieve the disappearance of jquery in two seconds" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about related articles, please follow the industry information channel.

Tags: Elements queues functions articles methods syntax delays content effects hints appropriateness parameters names properties layout ideas tutorials new knowledge time more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Information vpn Microsoft Shulou Technology