/**
* OffCanvas module.
- * @module foundation.offcanvas
+ * @module foundation.offCanvas
* @requires foundation.util.keyboard
* @requires foundation.util.mediaQuery
* @requires foundation.util.triggers
* @private
*/
_events() {
- this.$element.off('.zf.trigger .zf.offcanvas').on({
+ this.$element.off('.zf.trigger .zf.offCanvas').on({
'open.zf.trigger': this.open.bind(this),
'close.zf.trigger': this.close.bind(this),
'toggle.zf.trigger': this.toggle.bind(this),
- 'keydown.zf.offcanvas': this._handleKeyboard.bind(this)
+ 'keydown.zf.offCanvas': this._handleKeyboard.bind(this)
});
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)});
}
}
} else {
_this.reveal(false);
}
- }).one('load.zf.offcanvas', function() {
+ }).one('load.zf.offCanvas', function() {
if (MediaQuery.atLeast(_this.options.revealOn)) {
_this.reveal(true);
}
}
/**
- * Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers.
+ * Stops scrolling of the body when OffCanvas is open on mobile Safari and other troublesome browsers.
* @private
*/
_stopScrolling(event) {
this.$triggers.attr('aria-expanded', 'true');
this.$element.attr('aria-hidden', 'false')
- .trigger('opened.zf.offcanvas');
+ .trigger('opened.zf.offCanvas');
this.$content.addClass('is-open-' + this.position);
* Fires when the off-canvas menu opens.
* @event OffCanvas#closed
*/
- .trigger('closed.zf.offcanvas');
+ .trigger('closed.zf.offCanvas');
this.$content.removeClass('is-open-left is-open-top is-open-right is-open-bottom');
}
/**
- * Destroys the offcanvas plugin.
+ * Destroys the OffCanvas plugin.
* @function
*/
_destroy() {
this.close();
- this.$element.off('.zf.trigger .zf.offcanvas');
- this.$overlay.off('.zf.offcanvas');
+ this.$element.off('.zf.trigger .zf.offCanvas');
+ this.$overlay.off('.zf.offCanvas');
}
}
transitionTime: null,
/**
- * Type of transition for the offcanvas menu. Options are 'push', 'detached' or 'slide'.
+ * Type of transition for the OffCanvas menu. Options are 'push', 'detached' or 'slide'.
* @option
* @type {string}
* @default push
forceTo: null,
/**
- * Allow the offcanvas to remain open for certain breakpoints.
+ * Allow the OffCanvas to remain open for certain breakpoints.
* @option
* @type {boolean}
* @default false
revealOn: null,
/**
- * Force focus to the offcanvas on open. If true, will focus the opening trigger on close.
+ * Force focus to the OffCanvas on open. If true, will focus the opening trigger on close.
* @option
* @type {boolean}
* @default true
autoFocus: true,
/**
- * Class used to force an offcanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
+ * Class used to force an OffCanvas to remain open. Foundation defaults for this are `reveal-for-large` & `reveal-for-medium`.
* @option
* @type {string}
* @default reveal-for-
revealClass: 'reveal-for-',
/**
- * Triggers optional focus trapping when opening an offcanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
+ * Triggers optional focus trapping when opening an OffCanvas. Sets tabindex of [data-off-canvas-content] to -1 for accessibility purposes.
* @option
* @type {boolean}
* @default false
plugin.$overlay.should.be.an('object');
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
plugin.$overlay.trigger('click');
plugin.$element.should.not.have.class('is-open');
done();
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
//$html.one(Foundation.transitionend($html), function() {
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
plugin.$triggers.should.have.attr('aria-expanded', 'true');
plugin.$element.should.have.attr('aria-hidden', 'false');
done();
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
setTimeout(function() {
plugin.$element.should.have.class('is-open');
$('body').should.have.class('is-off-canvas-open');
});
- it('fires opened.zf.offcanvas event', function(done) {
+ it('fires opened.zf.offCanvas event', function(done) {
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
done();
});
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
plugin.close();
plugin.$triggers.should.have.attr('aria-expanded', 'false');
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
setTimeout(function() {
plugin.close();
plugin.open();
});
- it('fires closed.zf.offcanvas event', function(done) {
+ it('fires closed.zf.offCanvas event', function(done) {
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
- $html.one('closed.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
+ $html.one('closed.zf.offCanvas', function() {
done();
});
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
plugin.$element.should.have.class('is-open');
done();
});
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
plugin.toggle();
plugin.$element.should.not.have.class('is-open');
$html = $(template).appendTo('body');
plugin = new Foundation.OffCanvas($html.find('[data-off-canvas]'), {});
- $html.one('opened.zf.offcanvas', function() {
+ $html.one('opened.zf.offCanvas', function() {
plugin.$element.focus()
.trigger(window.mockKeyboardEvent('ESCAPE'));