jQuery :: show div 7 seconds if another div is present

How can I, show a div for 7 seconds then hide when another div id is present on the page.

if (div == ‘blue’)
{
show this div for 7 seconds kinda thing;
}

// if #div_to_check is present
if ( $('#div_to_check').length > 0 ){

    // show div you want to show
    $('#div_to_show').show();

    setTimeout(function(){
        // this code will be executed after timeout
        $('#div_to_show').hide();
    }, 7000); //time in milliseconds, 7000ms = 7s

}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.