diff options
| -rw-r--r-- | public/assets/js/app.js | 19 | ||||
| -rw-r--r-- | public/assets/js/lib/NavView.js | 3 | ||||
| -rw-r--r-- | public/assets/js/lib/ProjectView.js | 7 | ||||
| -rw-r--r-- | templates/index.liquid | 4 |
4 files changed, 28 insertions, 5 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() diff --git a/public/assets/js/lib/NavView.js b/public/assets/js/lib/NavView.js index 110e1fb..1edca02 100644 --- a/public/assets/js/lib/NavView.js +++ b/public/assets/js/lib/NavView.js @@ -1,2 +1,5 @@ var NavView = View.extend({ + + + })
\ No newline at end of file diff --git a/public/assets/js/lib/ProjectView.js b/public/assets/js/lib/ProjectView.js index ef03094..f5e47bd 100644 --- a/public/assets/js/lib/ProjectView.js +++ b/public/assets/js/lib/ProjectView.js @@ -5,6 +5,13 @@ var ProjectView = View.extend({ initialize: function(opt){ this.gallery = new GalleryView () + this.project_id = this.$el.data("id") + }, + + show: function(){ + }, + + hide: function(){ }, }) diff --git a/templates/index.liquid b/templates/index.liquid index d0df8b2..a6b1e6e 100644 --- a/templates/index.liquid +++ b/templates/index.liquid @@ -106,7 +106,7 @@ <iframe class="cell" src="{{ media.uri }}"></iframe> {% endif %} {% endfor %} </div> - <div class="bottom {% if project.press %}press{% else %}nopress{% endif %}"> + <div class="bottom {% if project.press.length %}press{% else %}nopress{% endif %}"> <div class="headings five"> <span>YEAR</span> <span>CLIENT</span> @@ -132,6 +132,7 @@ <span class="description"> {{ project.brief }} </span> + {% if project.press.length %} <span> <ul> {% for link in project.press %} @@ -141,6 +142,7 @@ {% endfor %} </ul> </span> + {% endif %} </div> </div> </div> |
