diff options
Diffstat (limited to 'public/assets/js/app.js')
| -rw-r--r-- | public/assets/js/app.js | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 2bef5f5..89c1869 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -1,14 +1,47 @@ -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"); + +var app = (function() { + var app = {} + + app.init = function() { + app.bind() + app.build() + app.ready() + + app.iscroll_options = { + mouseWheel: true, + scrollbars: true, + click: is_android, + } } -}); + + app.bind = function() { + if (is_mobile) { + document.addEventListener('touchmove', function(e) { + e.preventDefault() + }) + FastClick.attach(document.body) + } + } + + app.build = function(data) { + app.nav = new NavView() + } + + app.ready = function() { + setTimeout(function(){ + $("body").removeClass("loading") + }, 20) + app.view = null + app.router = new SiteRouter() + app.router.launch() + console.log("launched") + } + + return app + +})() + +app.init() $('.top').flickity({ cellAlign: 'left', @@ -16,17 +49,17 @@ $('.top').flickity({ pageDots: false, wrapAround: true, arrowShape: { - x0: 10, - x1: 35, y1: 25, - x2: 40, y2: 25, - x3: 15 + x0: 10, + x1: 35, y1: 25, + x2: 40, y2: 25, + x3: 15 } }); $('.index').click( function(){ - $('body').toggleClass('navopen'); + $('body').toggleClass('navopen'); }); $('.item').click( function(){ - $('body').removeClass('navopen'); + $('body').removeClass('navopen'); }); |
