diff options
Diffstat (limited to 'public/assets/js/app.js')
| -rw-r--r-- | public/assets/js/app.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/public/assets/js/app.js b/public/assets/js/app.js index 7dabf26..13017f6 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -23,6 +23,13 @@ var app = (function() { } app.build = function(data) { + var items = $(".item") + app.lookup = {} + app.projects = items.toArray().map(function(el){ + var view = new ProjectView ({ el: el }) + app.lookup[ view.project_id ] = view + return view + }) app.nav = new NavView() } @@ -30,7 +37,10 @@ var app = (function() { setTimeout(function(){ $("body").removeClass("loading") }, 20) - app.view = null + + app.view = app.projects[0] + app.view.show() + console.log("launched") } @@ -38,7 +48,6 @@ var app = (function() { })() - $(".cell, .next").css({ 'height': ($(".top").height() + 'px') }); $('.top').flickity({ @@ -52,6 +61,9 @@ $('.top').flickity({ x2: 40, y2: 25, x3: 15 } +}).on( 'cellSelect', function(e) { + var gallery = $(e.target).data('flickity') + $(".slide-no").html(gallery.selectedIndex + 1) }) $(".previous, .next").css({ 'height': ($(".top").height() + 'px') }); @@ -83,5 +95,4 @@ $(window).resize(function() { }, 400); }) -app.init() - +// app.init() |
