jQuery isotope on first load doesn't work, How do I wait for all resources/images to be loaded?

后端 未结 7 1906
一个人的身影
一个人的身影 2021-01-17 16:57

I\'ve got something I\'ve put together using jQuery isotope here.. http://jsbin.com/eziqeq/6/edit

It seems to work in general but on first load, of a new tab, the Is

7条回答
  •  无人共我
    2021-01-17 17:33

    A much better way to fix this is to provide width and height to the isotope item and/or the images itself. With the widnow load method you'll end up waiting a few seconds before isotope kicks in and the layout will change which is weird.

    Here's what i use in a WordPress theme inside a post loop:

     $value ) {
                $image_medium   = wp_get_attachment_image_src( $value, 'medium');
                $image_full     = wp_get_attachment_image_src( $value, 'full'); 
    
                $w = $image_medium[1]; //Image Width
                $h = $image_medium[2]; //Image Height
    
    ?>
    
            
    
    

提交回复
热议问题