var is_iphone = (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)); var is_ipad = (navigator.userAgent.match(/iPad/i)); var is_android = (navigator.userAgent.match(/Android/i)) var is_mobile = is_iphone || is_ipad || is_android; $(function() { if (is_mobile) { $("html").addClass("mobile"); } else { $("html").addClass("desktop"); } }); $(".cell, .next").css({ 'height': ($(".top").height() + 'px') }); $('.top').flickity({ cellAlign: 'left', contain: true, pageDots: false, wrapAround: true, arrowShape: { x0: 10, x1: 35, y1: 25, x2: 40, y2: 25, x3: 15 } }); $(".previous, .next").css({ 'height': ($(".top").height() + 'px') }); $('.index').click(function() { $('body').toggleClass('navopen'); }); $('.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, .next, .previous").css({ 'display': 'none' }); $('body').addClass('resizing'); delay(function() { $(".cell, .next, .previous").css({ 'height': ($(".top").height() + 'px'), 'display': 'inline-block' }); $('.top').flickity('resize'); $('body').removeClass('resizing'); }, 400); });