I use materialbox (jQuery plugin to display Material Design lightbox style) when a new photo was taken from mobile end added to a dynamic list. When photo is ready and visible in the DOM, a template event starts:
Template.item.events({
'click .materialboxed':function(e,t){
setTimeout(function(){
$('.materialboxed').materialbox();
},0)
}
});
the DOM:
<div class="col s2" style="text-align:left;">
{{#if pictureExist}}
<img src="{{picture}}" alt="" class="responsive-img materialboxed"> <!-- notice the "circle" class -->
{{else}}
<div class="takePicture"><i class="mdi-image-photo-camera small"></i></div>
{{/if}}
</div>
Is there a best Meteor way instead setTimeout to instantiate jQuery code in reactive data?
Thanks
Aucun commentaire:
Enregistrer un commentaire