[英]how to make Invisible div contend in Jquery?
Can you please tell me how to make invisible content of div..In other words I make example in which I am printing a line in div .But It will not visible to user But it should write in div .but afer some time it is visible to user. 你能告诉我如何使div的内容不可见吗。换句话说,我举一个例子,在div中打印一行。但是它对用户不可见,但是应该在div中写。但是一段时间之后对用户可见。
I try visibility hidden But not work .. 我尝试隐藏可见性,但不起作用..
http://jsfiddle.net/QuETp/2/ http://jsfiddle.net/QuETp/2/
setInterval(function(){
$('#test').append('hi i am div.')
console.log($('#test').html());
},1000);
Add this line: 添加此行:
$('#test').hide();
at top. 在顶部。
And then add this part of code: 然后添加这部分代码:
setTimeout(function(){
$('#test').show('fade');
},5000);
So your full code will become: 因此,您的完整代码将变为:
$('#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.
Do you expect like this 你期望这样吗
HTML 的HTML
<div id="test"></div>
<input type="button" id="doBlock" value="doBlock">
CSS 的CSS
#test{
height:100px;
overflow:auto;
border:1px solid red;
width :100%;
display:none;
}
javascript javascript
setInterval(function(){
$('#test').append('hi i am div.')
//console.log($('#test').html());
},1000);
$( "#doBlock" ).click(function() {
$( "#test" ).css("display", "block");
});
Demo http://jsfiddle.net/QuETp/6/ 演示 http://jsfiddle.net/QuETp/6/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.