From a086d316e82ec012bc8f84fa653fc4ae562848ea Mon Sep 17 00:00:00 2001 From: “Ryder <“r@okfoc.us”> Date: Mon, 28 Mar 2016 18:31:41 -0400 Subject: resize --- public/assets/js/app.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'public/assets/js/app.js') diff --git a/public/assets/js/app.js b/public/assets/js/app.js index dd2a7e1..be7b585 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -12,9 +12,6 @@ $(function() { $(".cell").css({ 'height': ($(".top").height() + 'px') }); -$(window).resize(function() { - $(".cell").css({ 'height': ($(".top").height() + 'px') }); -}); $('.top').flickity({ cellAlign: 'left', @@ -37,4 +34,21 @@ $('.index').click(function() { $('.item').click(function() { $('body').removeClass('navopen'); +}); + + +var delay = (function() { + var timer = 0; + return function(callback, ms) { + clearTimeout(timer); + timer = setTimeout(callback, ms); + }; +})(); + +$(window).resize(function() { + $(".cell").css({ 'display': 'none' }); + delay(function() { + $(".cell").css({ 'height': ($(".top").height() + 'px'), 'display': 'inline-block' }); + $('.top').flickity('resize') + }, 400); }); \ No newline at end of file -- cgit v1.2.3-70-g09d2