diff options
Diffstat (limited to 'bgstack15-gallery-theme/static/js/app.js')
-rw-r--r-- | bgstack15-gallery-theme/static/js/app.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bgstack15-gallery-theme/static/js/app.js b/bgstack15-gallery-theme/static/js/app.js new file mode 100644 index 0000000..7233fa1 --- /dev/null +++ b/bgstack15-gallery-theme/static/js/app.js @@ -0,0 +1,36 @@ +$(".gallery").colorbox({ + rel:"gallery", + transition:"none", + maxWidth: "90%", + maxHeight: "90%", + scalePhotos: true, + current: "{current} / {total}", + title: function () { + title = this.title; + if(this.hasAttribute("data-big")) { + title += " (full size)".link(this.getAttribute("data-big")); + } + if(this.hasAttribute("data-date")) { + title += this.getAttribute("data-date"); + } + return title; + }, + inline: function() { + return this.hasAttribute("inline"); + } +}); + +$(document).bind('cbox_open', function(){ + $("#cboxOverlay, #colorbox").swipe({ + swipeLeft:function(event, direction, distance, duration, fingerCount) { + $.colorbox.next(); + }, + swipeRight:function(event, direction, distance, duration, fingerCount) { + $.colorbox.prev(); + }, + tap:function(event, target){ + $.colorbox.close() + }, + excludedElements: $.fn.swipe.defaults.excludedElements + ", #colorbox" + }).unbind("click"); +}); |