This commit is contained in:
Anna Sudnitsina 2018-03-27 22:41:25 +03:00
parent 3eec91d598
commit c30afc1d95
3 changed files with 28 additions and 26 deletions

View File

@ -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;
}
})
}

View File

@ -9,31 +9,5 @@
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
// 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;
}
})
}
</script>
{% endblock content %}

View File

@ -9,6 +9,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" href="{% static 'imagehosting/css/style.css' %}">
<script type="text/javascript" src="{% static 'imagehosting/js/script.js' %}"></script>
<style>
</style>
</head>