Update media-library.js

Adjusted for default dimention based on window width (css media query)
fixed class lookup as .thumbnail has 0 height on load.
This commit is contained in:
Gustavo Tandeciarz 2015-10-13 07:26:13 -04:00
parent 63ca6ee2d8
commit 99695f07cc

View File

@ -71,10 +71,11 @@ $(function () {
var listWidth = $('#media-library-main-list').width();
var listHeight = $('#media-library-main-list').height();
var itemWidth = $('.thumbnail').first().width();
var itemHeight = $('.thumbnail').first().height();
if (itemHeight == 0) itemHeight = 200;
if (itemWidth == 0) itemWidth = 200;
var itemWidth = $('#media-library-main-list li').first().width();
var itemHeight = $('#media-library-main-list li').first().height();
var defaultDimension = $(window).width() < 1420 ? 120 : 200;
if (itemHeight == 0 || itemHeight == null) itemHeight = defaultDimension;
if (itemWidth == 0 || itemHeight == null) itemWidth = defaultDimension;
var draftText = $("#media-library").data("draft-text");
var itemsPerRow = Math.floor(listWidth / itemWidth);