问题描述
如何检查我的所有j个查询文件是否已完全加载.
How to check my all j Query files are completely loaded or not.
我只想在与该div相关的所有jQuery文件加载后才显示div.
I want to show my div only when all the jQuery files related to that div is loaded.
文档就绪和窗口加载功能不起作用.
document ready and window load function doesn't work.
如何编写条件函数,您可以在其中检查是否所有的jQuery都已加载,然后显示div....我正在外部js文件中调用我的所有jQuery文件,(基本上,我正在尝试为该插件创建一个插件我的客户端,以便我的external.js文件可以从我的服务器远程运行.
How to write a conditional function where u can check whether all the jQuery is loaded then show the div.... i am calling all my jQuery files in an external js file, (basically i am trying to create a plugin for my client so that my external.js file will work from my server remotely).
我的external.js文件如下所示:
my external.js file goes like this:
if (typeof jQuery === "undefined") {
var script = document.createElement('script');
script.src = 'js/jquery-1.7.1.min.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
}
if (typeof jQuery === "undefined") {
var script = document.createElement('script');
script.src = 'js/fancybox.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
}
document.ready = function() {
$(document).ready(function(){
$("#addimage").html("<a id='fancybox' href='large"+clientID+".jpg'><img border=0 src='thumb"+clientID+".jpg'/></a>");
}
});
所以我希望此addimage div仅在我的jquery文件完全加载时起作用
so i want this addimage div work only my jquery files is loaded completely
推荐答案
好,您需要一个JavaScript加载程序.您可以使用headjs或modernizr或yepnope.它们具有回调功能,您可以在其中放置在已加载某些javascript文件时运行的脚本
ok you need a javascript loader.. you can use headjs or modernizr or yepnope. they have callback capabilities where you can put your scripts that will run when a certain javascript file is already loaded
这篇关于检查是否所有的jquery文件都已加载,然后运行与其相关的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!