Fix the items count in media library when modify the item size in css

Item shape is square in the media library. If the item size in
orchard-medialibrary-admin.css modified for different width and height,
the count of items will be wrong.
This commit is contained in:
yw80
2015-06-27 17:43:51 +08:00
parent 42dae3edf3
commit 51a364a184

View File

@@ -71,11 +71,12 @@ $(function () {
var listWidth = $('#media-library-main-list').width();
var listHeight = $('#media-library-main-list').height();
var itemSize = $('.thumbnail').first().width();
var itemWidth = $('.thumbnail').first().width();
var itemHeight = $('.thumbnail').first().height();
var draftText = $("#media-library").data("draft-text");
var itemsPerRow = Math.floor(listWidth / itemSize);
var itemsPerColumn = Math.ceil(listHeight / itemSize);
var itemsPerRow = Math.floor(listWidth / itemWidth);
var itemsPerColumn = Math.ceil(listHeight / itemHeight);
var pageCount = itemsPerRow * itemsPerColumn;