upd
This commit is contained in:
parent
3eec91d598
commit
c30afc1d95
27
imagehosting/static/imagehosting/js/script.js
Normal file
27
imagehosting/static/imagehosting/js/script.js
Normal 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;
|
||||
}
|
||||
})
|
||||
}
|
|
@ -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 %}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user