php - Change CSS values with jQuery -


there.

so, i'm using masonry jquery plugin make image gallery mosaic. ok, script works "fine", when load page images css alignment wrong, or not working. see:

screenshot

however, if press ctrl+scroll, or ctrl++/ctrl+-, script works:

screenshot

why? how can fix it?

my js:

    $(function(){         var $container = $("#galeria");             $container.masonry({             itemselector : 'li',             columnwidth : 200             });     }); 

my css:

.organizar-galeria{ width: 100%; } .organizar-galeria ul li{ width: 200px; } .organizar-galeria ul li img{ float: left; width: 100%; } #galeria{ width: 100%; float: left; padding: 5px 0px 10px 0px; } 

my html:

       <div id="galeria">         <div class="organizar-galeria">         <?php if($gallerydao->countfetch['qntfotos'] == 0 , $userdao->getuid() == $_session['uid']) { ?>          <p>parece que você ainda não tem nenhuma foto. se o dia estiver legal, que tal tirar uma?</p>         </div>      <?php } else { ?>          <ul>             <?php while($gallerydao->data = $gallerydao->query->fetch( pdo::fetch_assoc )):                 $var = getimagesize($gallerydao->getimagethumb()); ?>                 <li>                     <?php if( $userdao->getuid() == $_session['uid'] ): ?>                         <a id="<?php echo $gallerydao->getimageid(); ?>" class="remover" href="#" >x</a>                     <?php endif; ?>                     <a id="pictures"rel="group1" title="<?php echo $gallerydao->getlegenda(); ?>" href="<?php echo $gallerydao->getimageurl(); ?>" target="_blank">                         <img class="excluirimg" <?=$var[3];?> src="<?php echo $gallerydao->getimagethumb(); ?>" alt="imagem de <?php echo $userdao->getnome(); ?>" /></a>                  </li>             <?php endwhile; ?>         </ul>     </div> 

i try window.load , document.ready.

thanks.

i don't know masonry, maybe function executes early.

did try following, designed image-loading:

$(function(){     var $container = $('#galeria');     $container.imagesloaded(function(){          $container.masonry({               itemselector : 'li',               columnwidth : 200          });     }); }); 

best of luck,
robson


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -