diff --git a/flex-images.js b/flex-images.js index 3afa085..426d195 100644 --- a/flex-images.js +++ b/flex-images.js @@ -3,7 +3,7 @@ Copyright (c) 2014 Simon Steinberger / Pixabay GitHub: https://github.com/Pixabay/JavaScript-flexImages License: http://www.opensource.org/licenses/mit-license.php -*/ + */ var flexImages = (function(){ // "use strict"; @@ -29,7 +29,9 @@ var flexImages = (function(){ row_width += items[i][2] + o.margin; if (row_width >= max_w) { var margins_in_row = row.length * o.margin; - ratio = (max_w-margins_in_row) / (row_width-margins_in_row), row_h = Math.ceil(o.rowHeight*ratio), exact_w = 0, new_w; + var ratio = (max_w-margins_in_row) / (row_width-margins_in_row); + var row_h = Math.ceil(o.rowHeight*ratio); + var exact_w = 0, new_w; for (x=0; x 900 ? o['rowHeight'] = Math.floor(grid.clientWidth / 5) : o['rowHeight'] = 180; + } if (!containers.length) continue; var s = window.getComputedStyle ? getComputedStyle(containers[0], null) : containers[0].currentStyle; o.margin = (parseInt(s.marginLeft) || 0) + (parseInt(s.marginRight) || 0) + (Math.round(parseFloat(s.borderLeftWidth)) || 0) + (Math.round(parseFloat(s.borderRightWidth)) || 0); for (var j=0;j