From ac14d77fdb071828806bebf1920e1b150f3c6359 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 30 Mar 2016 13:31:21 -0400 Subject: heights --- public/assets/js/app.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'public/assets/js/app.js') diff --git a/public/assets/js/app.js b/public/assets/js/app.js index eff6dab..c21ed73 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -27,7 +27,7 @@ var app = (function() { document.addEventListener('touchmove', function(e) { e.preventDefault() }) - // FastClick.attach(document.body) + FastClick.attach(document.body) } $(window).resize(app.resize) @@ -70,7 +70,11 @@ var app = (function() { 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 }) }) app.view.$el.removeClass("hidden") // $('.top').flickity('resize') @@ -84,8 +88,12 @@ var app = (function() { })() $(".item").each(function(i){ - var height = window.innerHeight - $(this).find(".bottom").height() + 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 }) + $(".bottom", this).css({ 'top': height + 20 }) }) $('.top').each(function(){ @@ -99,6 +107,9 @@ $('.top').each(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, .flickity-viewport", this).css({ 'height': height }) }) -- cgit v1.2.3-70-g09d2 From ee352086ea4d61b08b730e9b78858a5750455d6a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 30 Mar 2016 13:49:13 -0400 Subject: resize --- public/assets/js/app.js | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'public/assets/js/app.js') 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) { -- cgit v1.2.3-70-g09d2