![](/img/trans.png)
[英]Using JS/jQuery to make a div invisible based on the contents of a child div
[英]how to make Invisible div contend in Jquery?
你能告诉我如何使div的内容不可见吗。换句话说,我举一个例子,在div中打印一行。但是它对用户不可见,但是应该在div中写。但是一段时间之后对用户可见。
我尝试隐藏可见性,但不起作用..
setInterval(function(){
$('#test').append('hi i am div.')
console.log($('#test').html());
},1000);
添加此行:
$('#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.
你期望这样吗
的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;
}
javascript
setInterval(function(){
$('#test').append('hi i am div.')
//console.log($('#test').html());
},1000);
$( "#doBlock" ).click(function() {
$( "#test" ).css("display", "block");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.