你能告诉我如何使 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.
关于javascript - 如何在 Jquery 中制作不可见的 div 内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23166216/