javascript - 如何在 Jquery 中制作不可见的 div 内容?

标签 javascript jquery css

你能告诉我如何使 div 的内容不可见吗..换句话说,我举了一个例子,我在 div 中打印一行。但是它对用户不可见但是它应该写在 div 中。但是一些用户可见的时间。

我尝试隐藏可见性但不起作用..

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

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.

Demo

关于javascript - 如何在 Jquery 中制作不可见的 div 内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23166216/

相关文章:

javascript - 如何使用javascript获取svg中矩形标签的边界值

javascript - 从多个数组构建自定义 JSON 数组

css - 切换 CSS 以在 Rails 中使用 Assets 管道?

javascript - HTML 标题 a[href] jQuery

javascript - 使用右浮动元素的响应式网页设计

javascript - 滚动到顶部 Jquery 不工作

html - <table> 在所有现代浏览器中的意外盒子模型行为

javascript - 防止在当前动画运行时跳转到下一个动画的开始

javascript - 如何移动div中的重新定位元素

html - 表格 tr 高度固定不适用于 Chrome