2014-04-19 2 views
0

div의 보이지 않는 내용을 만드는 방법을 알려주실 수 있습니다. 다른 말로하면 div에 줄을 인쇄하는 예제를 만듭니다.하지만 사용자에게는 보이지 않습니다.하지만 div .but afer로 작성해야합니다. 사용자가 볼 수 있습니다.보이지 않는 div가 Jquery에서 경쟁하게하려면 어떻게해야합니까?

나는

setInterval(function(){ 

$('#test').append('hi i am div.') 
console.log($('#test').html()); 
},1000); 

답변

0

http://jsfiddle.net/QuETp/2/

이 줄을 추가 .. 가시가 숨겨져 그러나 작동하지보십시오 상단에

$('#test').hide(); 

.

그리고 코드의이 부분을 추가합니다

setTimeout(function(){ 
    $('#test').show('fade'); 
},5000); 

를 따라서 당신의 전체 코드가 될 것이다 :

$('#test').hide(); // hides the div 

setInterval(function() { 
    $('#test').append('hi i am div.') 
    console.log($('#test').html()); 
}, 1000); // adds line to the div 

setTimeout(function() { 
    $('#test').fadeIn(); 
}, 5000); // shows the div after 5 seconds with fading animation. 

Demo

0

HTML 같은 기대

<div id="test"></div> 

<input type="button" id="doBlock" value="doBlock"> 

CSS

#test{ 

    height:100px; 
    overflow:auto; 
    border:1px solid red; 
    width :100%; 
    display:none; 
} 

자바 스크립트

setInterval(function(){ 

$('#test').append('hi i am div.') 
//console.log($('#test').html()); 
},1000); 

$("#doBlock").click(function() { 
    $("#test").css("display", "block"); 
}); 

데모 http://jsfiddle.net/QuETp/6/

관련 문제