Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the fadeout method in jquery

Shulou Source: shulou.com Published: 2022-05-31 22:10:44 09月21日 Update

This article introduces the relevant knowledge of "how to use the fadeout method in jquery". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In jquery, the fadeout () method is used to gradually change the opacity of the selected element, hiding from visible; the element hidden by this method will not affect the layout of the page, and the parameters in the setting method can change the speed at which the element fades. The syntax is "element object .fadeOut (speed,easing, execute function)".

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

How to use fadeout method in jquery

The fadeOut () method gradually changes the opacity of the selected element from visible hiding (fading effect).

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

Tip: this method is usually used with the fadeIn () method.

Grammar

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

The parameters are expressed as follows:

Speed is optional. Specifies the speed of the fading effect. Possible values:

Millisecond

"slow"

"fast"

Easing is optional. Specifies the speed of the element at different points in the animation. The default is "swing". Possible values:

"swing"-move slowly at the beginning / end and fast in the middle

"linear"-moving at a uniform speed

Tip: more easing functions are available in the extension.

Callback is optional. The function to be executed after the fadeOut () method is executed.

Examples are as follows:

(document) .ready (function () {$(".btn1") .click (function () {$("p"). FadeOut ()}); fade out

This is a paragraph.

Output result:

This is the end of the content of "how to use the fadeout method in jquery". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Methods elements functions more speed movement content parameters layout effects knowledge syntax transparency pages influences hints output different practical learned Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Tech Info Microsoft OPPO Reno Docker