Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 加载带有图像的html文件后运行Jquery脚本_Javascript_Jquery_Html_Image - Fatal编程技术网

Javascript 加载带有图像的html文件后运行Jquery脚本

Javascript 加载带有图像的html文件后运行Jquery脚本,javascript,jquery,html,image,Javascript,Jquery,Html,Image,以下是我的代码: 索引文件: <div class="other">other images</div> <div class="fotos"> <?php include ('images.html'); ?> </div> images.html: <img src="image1.jpg"></img> <img src="image2.jpg"></img> <img s

以下是我的代码:

索引文件:

<div class="other">other images</div>

<div class="fotos">
<?php include ('images.html'); ?>
</div>
images.html:

<img src="image1.jpg"></img>
<img src="image2.jpg"></img>
<img src="image3.jpg"></img>
<img src="image4.jpg"></img>
<img src="image5.jpg"></img>

问题是:脚本“center.js”必须在加载所有图像后运行。 有人能帮忙吗

thanx,gr Tim


将它放在所有代码下面。例如,在最后添加脚本。控制台上是否有任何错误。请在页面加载$('.other')之前加载它。单击(function(){$.getScript(“javascript/center.js”);$('.fotos').Load('otherimages.html');});
<img src="image1.jpg"></img>
<img src="image2.jpg"></img>
<img src="image3.jpg"></img>
<img src="image4.jpg"></img>
<img src="image5.jpg"></img>
$('.other').click (function() {
    $('.fotos').load('otherimages.html', function() {
        $.getScript("javascript/center.js");
    });
});