2014-01-22 134 views
1

我有一個div,當頁面加載時我想隱藏並且想在幾秒後顯示相同的內容。我是否使用jquery進行此操作。頁面加載時隱藏div,幾秒後顯示相同

HTML代碼

<div id="bio1"> 
<div class="carousel_titles"> 
    <h6>Saul Yarmak</h6> 
     <div class="ops">Chairman & CEO</div> 
    </div> 
    <div class="img_block wrapped_imgs"> 
     <img src="img/pictures/team1.jpg" alt="Tom" /> 
    </div> 
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make </p> 
</div> 

回答

4

你應該在默認情況下使用CSS隱藏:

#bio1 { 
    display:none; 
} 

,然後你可以使用delay()幾秒鐘後表現出來:

$('#bio1').delay(3000).fadeIn(); 

Fiddle Demo

+0

它應該放在ready函數裏面嗎? – Shareer

+1

@Shareer當然是:) – Felix

2

開始與它隱藏:

#bio1{ 
    display:none; 
} 

當頁面就緒,創建一個超時功能,再經過3000 MS(3秒),顯示DIV。

$(document).ready(function(){ 
    setTimeout(function(){ 
     $('#bio1').show(1000); 
    }, 3000); 
}); 
-1

請試試這個Fiddle dem ○: -

CSS

#bio1 { 
    display: none; 
} 

jQuery的

$(document).ready(function(){ 
    setTimeout("jQuery('#bio1').show();",3000); // Display div after 3 second 
}); 

DEMO

1

試試這個代碼:

DEMO

$(document).ready(function() { 
    var hashes ="#a1_bio"; 
     $(hashes).hide(); 
     setTimeout(function() 
        { 
         $(hashes).fadeIn(); 
        },2000) 
    });