summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author“Ryder <“r@okfoc.us”>2016-03-30 12:43:50 -0400
committer“Ryder <“r@okfoc.us”>2016-03-30 12:43:50 -0400
commitd755e31b7cd8c79c31c209283962d89451923d9d (patch)
tree98e5423312f27210154db333dd991109276d8ff9
parent3f332c7a43b90f21255412efc6f17104b2f1703c (diff)
parent42ca8182e820d95e939321bf027886824b25624d (diff)
merge
-rw-r--r--public/assets/js/app.js33
-rw-r--r--public/assets/js/lib/ProjectView.js15
2 files changed, 32 insertions, 16 deletions
diff --git a/public/assets/js/app.js b/public/assets/js/app.js
index f8c8025..eff6dab 100644
--- a/public/assets/js/app.js
+++ b/public/assets/js/app.js
@@ -63,14 +63,17 @@ var app = (function() {
}
app.resize = function(){
- $(".active .gallery .cell,.active .next,.active .gallery .previous").css({ 'display': 'none' })
+ // $(".active .cell,.active .next,.active .previous").css({ 'display': 'none' })
$('body').addClass('resizing')
debounce(function() {
$(".active.item").addClass("hidden")
setTimeout(function(){
- $(".active .gallery.cell,.active .gallery .next,.active .gallery .previous").css({ 'height': ($(".active .gallery.top").height() + 'px'), 'display': 'inline-block' })
+ $(".item").each(function(i){
+ var height = window.innerHeight - $(this).find(".bottom").height()
+ $(".previous, .next, .cell, .top, .flickity-viewport", this).css({ 'height': height })
+ })
app.view.$el.removeClass("hidden")
- $('.active .gallery.top').flickity('resize')
+ // $('.top').flickity('resize')
$('body').removeClass('resizing')
}, 400)
}, 400)
@@ -80,21 +83,23 @@ var app = (function() {
})()
-var heights = []
-$(".top").each(function(i){
- var height = $(this).height()
- heights[i] = height
- $(".cell", this).css({ 'height': (height + 'px') })
+$(".item").each(function(i){
+ var height = window.innerHeight - $(this).find(".bottom").height()
+ $(".cell, .top", this).css({ 'height': height })
})
-$('.gallery.top').flickity(app.flickity_options).on( 'cellSelect', function(e) {
- var gallery = $(e.target).data('flickity')
- app.header.updateSlideNumber( gallery.selectedIndex )
+$('.top').each(function(){
+ if ($(this).find(".cell").length > 1) {
+ $(this).flickity(app.flickity_options).on( 'cellSelect', function(e) {
+ var gallery = $(e.target).data('flickity')
+ app.header.updateSlideNumber( gallery.selectedIndex )
+ })
+ }
})
-$(".top").each(function(i){
- var height = heights[i]
- $(".previous, .next", this).css({ 'height': (height + 'px') })
+$(".item").each(function(i){
+ var height = window.innerHeight - $(this).find(".bottom").height()
+ $(".previous, .next, .flickity-viewport", this).css({ 'height': height })
})
$(".item").addClass("hidden")
diff --git a/public/assets/js/lib/ProjectView.js b/public/assets/js/lib/ProjectView.js
index 726a430..575174b 100644
--- a/public/assets/js/lib/ProjectView.js
+++ b/public/assets/js/lib/ProjectView.js
@@ -12,8 +12,19 @@ var ProjectView = View.extend({
this.project_id = this.$el.data("id")
this.page_number = opt.page_number
console.log("INIT", this.project_id)
- $("<div>").addClass("page-up").insertAfter( this.$(".flickity-viewport") )
- $("<div>").addClass("page-down").insertAfter( this.$(".flickity-viewport") )
+
+ var $viewport = this.$(".flickity-viewport")
+ if (! $viewport.length) {
+ $viewport = this.$(".cell")
+ }
+ if (! $viewport.length) {
+ this.$(".top").append( $("<div>").addClass("page-up") )
+ this.$(".top").append( $("<div>").addClass("page-down") )
+ }
+ else {
+ $("<div>").addClass("page-up").insertAfter( $viewport )
+ $("<div>").addClass("page-down").insertAfter( $viewport )
+ }
},
show: function(){