var app = (function() { var app = {} var last_t = 0, initial_t = 0 app.init = function() { app.loader = new Loader () app.okcms = new OKCMS () app.okcms.getAll().done(function(data) { app.bind() app.build(data) app.resize() app.ready() }).fail(function(err) { console.error('error loading cms', err) }) } app.bind = function() { if (is_mobile) { document.addEventListener('touchmove', function(e) { e.preventDefault() }) FastClick.attach(document.body) } $(window).resize(app.resize) } app.build = function(data) { window.scrollTo(0,0) app.views = {} app.nav = new NavView () app.views.home = new HomeView({ data: data.home }) app.views.page = new PageView({ data: data.page }) app.views.painting = new PaintingView({ data: data.painting }) app.views.list = new ListView({ }) app.preload() } app.preload = function(){ var $sections = $("#fullpage .section") var $first = $sections.first() app.loader.preloadImage( $first.data("image"), function(){ $sections.each(function(index){ var img = new Image () var $div = $("