Friday, August 22, 2014

Auto Hide Div Using jquery

Hiding div is very useful. You can use this functionality for hiding alert message, theme or content. For hiding div I have used javascript.

Method-1:

function autoHideDiv()
{
    $(function ()
    {
        setTimeout(function ()
        {
            $("#divMsg").fadeOut(5000);
        }, 5000);
    });
}


this function start hiding div after 5 seconds and fades out completely in next 5 seconds.

Method-2:

function autoHideDiv()
{   
    $("#divMsg").delay(5000).fadeOut(5000);
}

 

No comments:

Post a Comment