[英]how to make sure the page is loading only after the jquery is loaded
I have a jsp page with jquery-ui somehow it's taking time to load . 我有一个带有jquery-ui的jsp页面,以某种方式需要花费一些时间来加载。 I have hide the dom and onload function I am writing the following code
我隐藏了dom和onload函数,我正在编写以下代码
setInterval(function(){
if(typeof jQuery.ui !=undefined )
{
$(document.body).css("visibility", "visible");
}
},5000)
I don't want to run the function once condition get true , how to achieve it 我不想在条件为真时运行该函数,如何实现
Write your all code inside the: 在以下位置编写所有代码:
$( document ).ready(function() {
console.log( "ready!" ); //Here you can put all the code
});
Once you DOM(Document object model) is ready then your js code will run, which is written inside the document ready function. 一旦您准备好DOM(文档对象模型),您的js代码就会运行,并在文档就绪函数中编写。
Put your code inside a $( document ).ready()
block. 将您的代码放在
$( document ).ready()
块中。 As shown below. 如下所示。
$( document ).ready(function() { console.log( "ready!" ); });
OR shorthand for $( document ).ready() 或$(document).ready()的简写
$(function() { console.log( "ready!" ); });
You may refer to this documentation for more information. 您可以参考本文档以获取更多信息。 https://learn.jquery.com/using-jquery-core/document-ready/
https://learn.jquery.com/using-jquery-core/document-ready/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.