summaryrefslogtreecommitdiff
path: root/public/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js')
-rw-r--r--public/assets/js/app.js18
-rw-r--r--public/assets/js/lib/ProjectView.js25
2 files changed, 31 insertions, 12 deletions
diff --git a/public/assets/js/app.js b/public/assets/js/app.js
index 040b99c..91ccdaf 100644
--- a/public/assets/js/app.js
+++ b/public/assets/js/app.js
@@ -40,13 +40,12 @@ var app = (function() {
app.header = new HeaderView()
app.nav = new NavView()
- // should this go here or elsewhere?
- app.resizeItems()
+ app.$items = $(".item")
- var $items = $(".item")
+ app.resizeItems()
app.lookup = {}
- app.projects = $items.toArray().map(function(el, i){
+ app.projects = app.$items.toArray().map(function(el, i){
var view = new ProjectView ({
el: el,
page_number: i,
@@ -98,11 +97,20 @@ var app = (function() {
}
app.resizeItems = function(){
+ var windowHeight = window.innerHeight
+
+ if (is_iphone) {
+ windowHeight -= 44 // account for lower bar
+ window.scrollTo(0,0)
+ }
+
$(".item").each(function(i){
- var height = window.innerHeight - ($(this).find(".bottom").height() + 10)
+
+ var height = windowHeight - ($(this).find(".bottom").height() + 10)
if (is_desktop) {
height -= $("nav").height() // account for top bar
}
+
$(".cell, .top, .previous, .next, .flickity-viewport", this).css({ 'height': height })
var cellCount = $(this).find(".cell").length
if ($.browser.mozilla) {
diff --git a/public/assets/js/lib/ProjectView.js b/public/assets/js/lib/ProjectView.js
index 97a7e1c..7e38d2a 100644
--- a/public/assets/js/lib/ProjectView.js
+++ b/public/assets/js/lib/ProjectView.js
@@ -9,10 +9,7 @@ var ProjectView = View.extend({
initialize: function(opt){
// this.gallery = new GalleryView ()
- this.project_id = this.$el.data("id")
- this.page_number = opt.page_number
- this.slide_count = this.$(".cell").length
-
+
this.$iframes = this.$(".cell.iframe")
this.$images = this.$(".cell.image")
this.$videos = this.$(".cell.video")
@@ -20,8 +17,17 @@ var ProjectView = View.extend({
this.images = this.$images.toArray().map(function(img){ return $(img).data("uri") })
if (is_mobile) {
- $iframes.remove()
- $videos.remove()
+ this.$iframes.remove()
+ this.$videos.remove()
+ this.$iframes = this.$videos = $(".nothing")
+ if (this.$(".mobile").length) {
+ this.$(".desktop").remove()
+ this.$(".mobile").removeClass("desktop")
+ }
+ }
+ else {
+ this.$(".mobile").remove()
+ this.$(".desktop").removeClass("desktop")
}
if (this.$(".cell").length > 1) {
@@ -47,7 +53,12 @@ var ProjectView = View.extend({
this.$el.append( $("<figure>").addClass("page-up") )
this.$el.append( $("<figure>").addClass("page-down") )
}
-
+
+ // now that the gallery is ready, store this data..
+ this.project_id = this.$el.data("id")
+ this.page_number = opt.page_number
+ this.slide_count = this.$(".cell").length
+
this.$el.addClass('hidden')
},