在页面加载时隐藏特定类的div,然后在加载后再次显示 [英] Hide div with specific class while page is loading then show again after load

查看:398
本文介绍了在页面加载时隐藏特定类的div,然后在加载后再次显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面加载时隐藏特定的div类。结构是..

 < div id =container> 
< div class =project-item tv>< / div>
< div class =project-item radio>< / div>
< div class =project-item radio>< / div>
< div class =project-item tv>< / div>
< / div>

例如,我想在加载页面时用class radio隐藏DIV,然后再次显示它们加载。谢谢。

解决方案

首先,将其CSS值设为 display:none 然后,在一个Javascript文件中,jQuery解决方案将使用:

 <$ c $ (); 
$(#yourdivid)。show();
});

$(document).ready()确保在执行函数内的代码之前加载整个DOM

I want to hide an specific div class while page is loading. The structure is..

<div id ="container">
<div class="project-item tv"></div>
<div class="project-item radio"></div>
<div class="project-item radio"></div>
<div class="project-item tv"></div>
</div>

For example, I want to hide DIV with class radio while page is loading, then show them again after load. Thanks.

解决方案

First, set it's CSS value to display:none

Then, in a Javascript file, the jQuery solution would be to use:

$(document).ready(function() {
     $("#yourdivid").show();
});

$(document).ready() makes sure that the entire DOM is loaded before the code inside the function is executed

这篇关于在页面加载时隐藏特定类的div,然后在加载后再次显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆