diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-03-30 13:49:13 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-03-30 13:49:13 -0400 |
| commit | ee352086ea4d61b08b730e9b78858a5750455d6a (patch) | |
| tree | a28aced06a60e472c9e9fca753fc24f40aaebd31 | |
| parent | 0663f93a09b49ccf6681926fffe00858cddf2176 (diff) | |
resize
| -rw-r--r-- | public/assets/js/app.js | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 3669bf7..fa5dafe 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -68,43 +68,40 @@ var app = (function() { debounce(function() { $(".active.item").addClass("hidden") setTimeout(function(){ - $(".item").each(function(i){ - var height = window.innerHeight - $(this).find(".bottom").height() - if (is_desktop) { - height -= $("nav").height() // account for top bar - } - $(".previous, .next, .cell, .top, .flickity-viewport", this).css({ 'height': height }) - $(".bottom", this).css({ 'top': height + 13 }) - }) + app.resizeItems() app.view.$el.removeClass("hidden") // $('.top').flickity('resize') $('body').removeClass('resizing') }, 400) }, 400) } + + app.resizeItems = function(){ + $(".item").each(function(i){ + var height = window.innerHeight - ($(this).find(".bottom").height() + 10) + if (is_desktop) { + height -= $("nav").height() // account for top bar + } + $(".cell, .top, .previous, .next, .flickity-viewport", this).css({ 'height': height }) + var cellCount = $(this).find(".cell").length + if (cellCount == 0) { + console.log($(this).data("id"), "NONE") + $(".bottom", this).css({ 'top': height + 17 }) + } + else if (cellCount == 1) { + $(".bottom", this).css({ 'top': height + 13 }) + } + else { + $(".bottom", this).css({ 'top': height + 19 }) + } + }) + } return app })() -$(".item").each(function(i){ - var height = window.innerHeight - ($(this).find(".bottom").height() + 10) - if (is_desktop) { - height -= $("nav").height() // account for top bar - } - $(".cell, .top", this).css({ 'height': height }) - var cellCount = $(this).find(".cell").length - if (cellCount == 0) { - console.log($(this).data("id"), "NONE") - $(".bottom", this).css({ 'top': height + 17 }) - } - else if (cellCount == 1) { - $(".bottom", this).css({ 'top': height + 13 }) - } - else { - $(".bottom", this).css({ 'top': height + 19 }) - } -}) +app.resizeItems() $('.top').each(function(){ if ($(this).find(".cell").length > 1) { |
