accurator/commit
Removed canvas from thumbs and readding listener after being replaced.
author | Chris Dijkshoorn |
---|---|
Thu Apr 21 11:21:48 2016 +0200 | |
committer | Chris Dijkshoorn |
Thu Apr 21 11:21:48 2016 +0200 | |
commit | 36e1ea3547178495741d2e1780f573a0e8f3ce35 |
tree | 201b924e543eaf4b8f07f0422f44cedc310432a1 |
parent | 70be65e4cb34e371fc25b498fe1e7cdfa974c831 |
Diff style: patch stat
diff --git a/web/js/components/cluster.js b/web/js/components/cluster.js index 1e796b9..e195acd 100644 --- a/web/js/components/cluster.js +++ b/web/js/components/cluster.js @@ -113,7 +113,7 @@ Cluster.prototype.addThumbnails = function(numberDisplayedItems) { this.items[i].link, numberDisplayedItems ); - + thumbnail.hide(); // hide until image is loaded thumbnail.setClickEvent(this.items[i].link, this.uris, this.path.path); this.thumbnails[i] = thumbnail; } @@ -145,6 +145,12 @@ Cluster.prototype.changeThumbnails = function(currentPage, nextPage, numberDispl // make sure the thumbnail shown (maybe returning from hidden state) _cluster.thumbnails[i].show(); + // reattach click (might be removed while element was replaced) + _cluster.thumbnails[i].setClickEvent( + _cluster.items[i].link, + _cluster.uris, + _cluster.path.path + ); thumbIndex++; } diff --git a/web/js/components/thumbnail.js b/web/js/components/thumbnail.js index ecfa919..e6f5e06 100644 --- a/web/js/components/thumbnail.js +++ b/web/js/components/thumbnail.js @@ -22,12 +22,6 @@ Thumbnail.prototype.init = function() { 'class':'thumbnail', 'id':this.id }, - $.el.canvas({ - 'class':'img-responsive', - 'width':'350px', - 'height':'300px', - 'style':'solid #d3d3d3' - }), $.el.img({ 'src':'', 'class':'img-responsive', @@ -49,14 +43,12 @@ Thumbnail.prototype.getId = function(uri) { } Thumbnail.prototype.setImage = function(url) { - // show canvas var _thumb = this; $(this.node).find("img").attr("src", url); - // wait for the image to load, remove canvas and show + // wait for the image to load, then show thumb $(this.node).find("img").on('load', function() { - $(_thumb.node).find("canvas").remove(); - $(_thumb.node).find("img").show(); + _thumb.show(); }); // replace image url