From c30afc1d950ccb5498057a08fcf409d071f59039 Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 27 Mar 2018 22:41:25 +0300 Subject: [PATCH] upd --- imagehosting/static/imagehosting/js/script.js | 27 +++++++++++++++++++ imagehosting/templates/imagehosting/all.html | 26 ------------------ imagehosting/templates/imagehosting/base.html | 1 + 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 imagehosting/static/imagehosting/js/script.js diff --git a/imagehosting/static/imagehosting/js/script.js b/imagehosting/static/imagehosting/js/script.js new file mode 100644 index 0000000..8673e28 --- /dev/null +++ b/imagehosting/static/imagehosting/js/script.js @@ -0,0 +1,27 @@ + +// resizer(); + // $(function() {resizer(); }) + $(window).load(function() {resizer(); + $('.spinner').fadeOut(); + $('#page-preloader').delay(350).fadeOut('slow');}) + + // $(window).on("load", function() {resizer(); }); + $(window).resize(function() { resizer(); }) + + function resizer() { + var imgs = $('img'); + var row_width = $(window).width() - 50; + var prev = []; + var total_w = 0; + imgs.each(function (i, e) { + $(this).height(200); + prev[prev.length] = $(e); + total_w += $(e).width(); + if (total_w > row_width) { + prev = $(prev); + prev.each(function (indx, element) {$(element).height(row_width*200/total_w)}); + prev = []; + total_w = 0; + } + }) + } diff --git a/imagehosting/templates/imagehosting/all.html b/imagehosting/templates/imagehosting/all.html index ba0054a..12b37f5 100644 --- a/imagehosting/templates/imagehosting/all.html +++ b/imagehosting/templates/imagehosting/all.html @@ -9,31 +9,5 @@ {% endblock content %} diff --git a/imagehosting/templates/imagehosting/base.html b/imagehosting/templates/imagehosting/base.html index e483944..e6c1876 100644 --- a/imagehosting/templates/imagehosting/base.html +++ b/imagehosting/templates/imagehosting/base.html @@ -9,6 +9,7 @@ +