if (this.options.closeOnClick === true) {
var $target = this.options.contentOverlay ? this.$overlay : this.$content;
- $target.on({'click.zf.offcanvas': this.close.bind(this)});
+ $target.on({'click.zf.offCanvas': this.close.bind(this)});
}
+
+ if (this.options.inCanvasOn) {
+ $(window).on('changed.zf.mediaquery', () => {
+ this._checkInCanvas();
+ });
+ }
+
}
/**
* @param {Object} event - Event object passed from listener.
* @param {jQuery} trigger - element that triggered the off-canvas to open.
* @fires OffCanvas#opened
+ * @todo also trigger 'open' event?
*/
open(event, trigger) {
- if (this.$element.hasClass('is-open') || this.isRevealed) { return; }
+ if (this.$element.hasClass('is-open') || this.isRevealed || this.isInCanvas) { return; }
var _this = this;
if (trigger) {