简体   繁体   English

如何在css之前加载javascript

[英]how to load javascript before css

I have displayed a loading bar before the entire page is loaded on my website. 在整个页面加载到我的网站之前,我已经显示了加载栏。
Here is the js which i am using 这是我正在使用的js
JsBin demo JsBin演示

Now the problem is when some one opens the web page , black background (css) appears and after 2-3 seconds loading bar shows the loading. 现在的问题是,当有人打开网页时,出现黑色背景(css),加载栏2-3秒后显示正在加载。 Though this is the first script which loads on the website. 虽然这是在网站上加载的第一个脚本。
Why loading bar gets delay. 为什么加载栏会延迟。 How can i load it dynamically ? 如何动态加载?
This is my website . 这是我的网站 Script name is javatest.js 脚本名称是javatest.js
Sorry if i missed anything , i am just a newbie 抱歉,如果我错过任何事情,我只是一个新手

Based on your comments it looks like you're after loading CSS via your JavaScript. 根据您的评论,看起来您就像是通过JavaScript加载CSS之后。 This has been answered here . 这里已经回答 I'm not sure if this will work with JSBin or not, so I suggest you test this in notepad or something else. 我不确定这是否适用于JSBin,因此建议您在记事本或其他工具中进行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM