vendor/assets/javascripts/furatto.js in furatto-1.2.7 vs vendor/assets/javascripts/furatto.js in furatto-1.3.7

- old
+ new

@@ -1,13 +1,13 @@ /*! - * Furatto v3.0.3 (http://icalialabs.github.io/furatto/) + * Furatto v3.1.0 (http://icalialabs.github.io/furatto/) * Copyright 2014-2014 Icalia Labs * Licensed under MIT (https://github.com/IcaliaLabs/furatto/blob/master/LICENSE) */ /*! - * Furatto v3.0.3 (http://icalialabs.github.io/furatto/) + * Furatto v3.1.0 (http://icalialabs.github.io/furatto/) * Copyright 2014-2014 Icalia Labs * Licensed under MIT (https://github.com/IcaliaLabs/furatto/blob/master/LICENSE) */ window.Furatto = { name: 'Furatto', @@ -30,16 +30,20 @@ this.hideOnEsc = __bind(this.hideOnEsc, this); this.show = __bind(this.show, this); this.init = __bind(this.init, this); this.options = $.extend({}, options); this.$el = $(el); - this.modal = $(this.$el.data('target')); - this.close = this.modal.find('.modal-close'); + if (this.$el.is('.modal')) { + this.$modal = this.$el; + } else { + this.$modal = $(this.$el.data('target')); + } + this.close = this.$modal.find('.modal-close'); this.transition = this.$el.data('transition') || "1"; this.theme = this.$el.data('theme') || "default"; - this.modal.addClass("modal-effect-" + this.transition); - this.modal.addClass("" + this.theme); + this.$modal.addClass("modal-effect-" + this.transition); + this.$modal.addClass("" + this.theme); } Modal.prototype.init = function() { var _this = this; this.$el.click(this.show); @@ -48,14 +52,14 @@ return _this.hide(); }); }; Modal.prototype.show = function(ev) { - if (this.$el.is('div')) { + if (this.$el.is('.modal')) { this.$el.addClass('modal-show'); } else { - this.modal.addClass('modal-show'); + this.$modal.addClass('modal-show'); } $('.modal-overlay').addClass('modal-show-overlay'); $('body').bind('keyup', this.hideOnEsc); return $('body').bind('click', this.hideOnDocumentClick); }; @@ -72,14 +76,14 @@ } }; Modal.prototype.hide = function() { $('.modal-overlay').removeClass('modal-show-overlay'); - if (this.$el.is('div')) { + if (this.$el.is('.modal')) { this.$el.removeClass('modal-show'); } else { - this.modal.removeClass('modal-show'); + this.$modal.removeClass('modal-show'); } $('body').unbind('keyup', this.hideOnEsc); return $('body').unbind('click', this.hideOnDocumentClick); }; @@ -98,10 +102,10 @@ if (typeof option === 'string') { return data[option](); } }); }; - Furatto.Modal.version = "1.0.0"; + Furatto.Modal.version = "1.0.1"; $(document).ready(function() { var elementToAppend; if ($('.off-screen').length > 0) { elementToAppend = $('.off-screen'); } else {