Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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
Jquery 加载<;img>;js前的html标记_Jquery_Css_Jquery Masonry - Fatal编程技术网

Jquery 加载<;img>;js前的html标记

Jquery 加载<;img>;js前的html标记,jquery,css,jquery-masonry,Jquery,Css,Jquery Masonry,我的问题是jQueryMashing会立即安排我的“砖块”,不要等待图像加载。此外,我希望图像具有响应性,因此我无法定义以下内容: <img src="asas" height= "100px" width="100px" alt="asas"> 活动示例的链接是。您可以将代码放在加载处理程序的窗口中,或者使用作者编写的插件 $(window).load(function(){ $('#wrapper').masonry({ ... }); }); 或: 我很想知

我的问题是jQueryMashing会立即安排我的“砖块”,不要等待图像加载。此外,我希望图像具有响应性,因此我无法定义以下内容:

<img src="asas" height= "100px" width="100px" alt="asas"> 


活动示例的链接是。

您可以将代码放在
加载处理程序的窗口中,或者使用作者编写的插件

$(window).load(function(){
    $('#wrapper').masonry({ ... });
});
或:


我很想知道这是否有效。从我所看到的,直到每个图像都加载了,它的比率是未知的,所以它的高度还没有定义,所以我认为答案应该是等到所有图像加载后再应用砖石。
load
事件在加载所有图像时激发,然而,对于砖石,我更喜欢使用
imagesLoaded
插件<代码>加载
事件已被弃用。@RichardA。非常感谢,我想文件准备好了也一样。你能给我推荐一些jquery/javascript的书吗?
var $wrapper = $('#wrapper');
$wrapper.imagesLoaded({
   done: function() {
        $wrapper.masonry({ ... });
   }
})
#wrapper img {
    width: 100%;
    height: auto;
}