diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-12-01 06:18:02 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-12-01 06:18:02 -0500 |
| commit | 44ba111c40ce50f8634a7e9bb4316315274218cb (patch) | |
| tree | 2575c846b8e5290b5a3aca7d6c143a545b92f269 /StoneIsland/www/js/lib/blogs | |
| parent | 5e257befde4a275ef807402b9e7e05264bf3ccc9 (diff) | |
fix gallery arrows
Diffstat (limited to 'StoneIsland/www/js/lib/blogs')
| -rw-r--r-- | StoneIsland/www/js/lib/blogs/HubView.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js index 001b8161..87f8127e 100644 --- a/StoneIsland/www/js/lib/blogs/HubView.js +++ b/StoneIsland/www/js/lib/blogs/HubView.js @@ -22,14 +22,16 @@ var HubView = ScrollableView.extend({ document.body.className = "hub" }, + galleries: {}, populate: function(data){ this.data = data this.$loader.hide() this.$content.empty() + this.galleries = {} // id date subtitle body link store image[uri caption] this.data.forEach(function(row){ // console.log(row) - var t = this.template.replace(/{{id}}/, row.id) + var t = this.template.replace(/{{id}}/g, row.id) .replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY")) .replace(/{{title}}/, row.title) .replace(/{{subtitle}}/, row.subtitle) @@ -50,7 +52,7 @@ var HubView = ScrollableView.extend({ el.className = "item" $gallery.append(el) }) - new Flickity( ".gallery-" + row.id, { + this.galleries[row.id] = new Flickity( ".gallery-" + row.id, { selector: '.item', cellAlign: 'center', autoPlay: false, @@ -76,8 +78,8 @@ var HubView = ScrollableView.extend({ play.className = "play" $(".gallery-" + row.id).append(play) } - $t.find("gallery-left").remove() - $t.find("gallery-right").remove() + $t.find(".gallery-left").remove() + $t.find(".gallery-right").remove() } }.bind(this)) @@ -89,11 +91,13 @@ var HubView = ScrollableView.extend({ app.router.go("store") }, - gallery_prev: function(e){ - $(e.currentTarget).closest("hub_item").flickity('prev') + gallery_left: function(e){ + var id = $(e.currentTarget).closest(".hub_item").data('id') + this.galleries[id].previous() }, - gallery_next: function(e){ - $(e.currentTarget).closest("hub_item").flickity('next') + gallery_right: function(e){ + var id = $(e.currentTarget).closest(".hub_item").data('id') + this.galleries[id].next() }, share: function(){ |
