Skip to content
Related Articles

Related Articles

Improve Article Fade Effect

  • Last Updated : 23 Nov, 2020
Geek Week

The Effect.fade() method can be used to fade away from the DOM. The Effect.Fade() can be used with Effect.Appear() method to fade away the content and then show it again.


new Effect.Fade(id_of_element, [options]);

This effect does not have any specific parameters. The common parameters of the visual effects module can be used.


<!DOCTYPE html>
    <script type="text/javascript" 
    <script type="text/javascript" 
    <script type="text/javascript">
        function ShowElement(element) {
            new Effect.Appear(element, 
                { duration: 1 });
        function HideElement(element) {
            new Effect.Fade(element, 
            { duration: 1, from: 1.0, to: 0 });
    <div onclick="ShowElement('element')">
        <Button>Show Content</Button>
    <br />
    <div onclick="HideElement('element')">
        <Button>Hide Content</Button>
    <br />
    <img id="element" src="GEEKSIMAGES/gfg.png">


Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :