diff --git a/js/offcanvas.js b/js/offcanvas.js index 2e4bd9cad..5f4fc31a2 100644 --- a/js/offcanvas.js +++ b/js/offcanvas.js @@ -61,6 +61,7 @@ recalc: true, disableScrolling: true, modal: false, + backdrop: false, exclude: null } @@ -408,9 +409,10 @@ } OffCanvas.prototype.autohide = function (e) { - if ($(e.target).closest(this.$element).length === 0) this.hide() - var target = $(e.target); - if (!target.hasClass('dropdown-backdrop') && $(e.target).closest(this.$element).length === 0) this.hide() + var $target = $(e.target); + var doHide = !$target.hasClass('dropdown-backdrop') && $target.closest(this.$element).length === 0; + + if (doHide) this.hide() } // OFFCANVAS PLUGIN DEFINITION @@ -424,6 +426,10 @@ var data = $this.data('bs.offcanvas') var options = $.extend({}, OffCanvas.DEFAULTS, $this.data(), typeof option === 'object' && option) + //In case if user does smth like $('.navmenu-fixed-left').offcanvas('hide'), + //thus selecting also menu clone (that can cause issues) + if ($this.hasClass('offcanvas-clone')) return + if (!data) $this.data('bs.offcanvas', (data = new OffCanvas(this, options))) if (typeof option === 'string') data[option]() })