javascript - Meteor/Masonry : wait until all templates are rendered -


this question similar meteor : wait until templates rendered, i'm asking again since seems unanswered in truth, i'll explain why.

having following template code

<template name="home">     <div>         <ul>             {{#each this}}                 {{> item}}             {{/each}}is ready         </ul>     </div> </template>  <template name="item">     <li><img src="{{amz-picture-url}}"></li> </template> 

i'd execute code once of "item" rendered. there're many of them , tried many methods onrendered, add iron-router's waiton home template, jquery's imagesloaded function try wait images...

the accepted answer in previous question uses iron-router wait data ready, need sub templates rendered besides data being ready, need call masonry.

is there realiable way of using mansory in meteor usecase or should change approach i'm using because there's no way mansory called @ right moment in context?

you add onload event handler <img>s counts calls. once reaches count of items, done.

something like:

<template name="item">     <li><img src="{{amz-picture-url}}" onload="countimages()"></li> </template> 

then in js:

var imagecounter = 0; function countimages() {     if(++imagecounter == this.length) {         // whatever need     } } 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -