summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/js/app.js20
1 files changed, 17 insertions, 3 deletions
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