events - Backbone.js view img onload -
events - Backbone.js view img onload -
i'm struggling backbone.js. i'm pretty new js , used as3 more object orientated
i seek create simple image gallery backbone. load 100 images , want them fade in if loaded.
i have in appview. every image url create 1 photoview
var view = new photoview({model: photo, list:this.imagelist}); this.imagelist.append(view.render().el);
in photoview utilize code attach onload() on img tag (found here):
render: function() { var self = this; this.$el.append(some_html_with_img_elements); this.$el.find('img').on('load', function() { self.img_loaded() }); homecoming this; }
the problem in img_loaded() same view on , on (the lastly view). know how maintain reference right view
pass this
argument img_loaded
, you'll reference image loaded, , manipulate want.
since didn't post code img_loaded
function i'm not sure if you're trying fade them in 1 @ time each loaded (a simple job 1 time pass in image reference), or wait until they're loaded , fade them in @ 1 time (would need code that).
events backbone.js image onload
Comments
Post a Comment