this.$element = element;
this.options = $.extend({}, OffCanvas.defaults, this.$element.data(), options);
this.$lastTrigger = $();
+ this.$triggers = $();
this._init();
this._events();
this.$element.attr('aria-hidden', 'true');
// Find triggers that affect this element and add aria-expanded to them
- $(document)
+ this.$triggers = $(document)
.find('[data-open="'+id+'"], [data-close="'+id+'"], [data-toggle="'+id+'"]')
.attr('aria-expanded', 'false')
.attr('aria-controls', id);
// _this._stick();
// }
});
+
+ this.$triggers.attr('aria-expanded', 'true');
this.$element.attr('aria-hidden', 'false')
.trigger('opened.zf.offcanvas');
}
if (trigger) {
- this.$lastTrigger = trigger.attr('aria-expanded', 'true');
+ this.$lastTrigger = trigger;
}
if (this.options.autoFocus) {
this.$exiter.removeClass('is-visible');
}
- this.$lastTrigger.attr('aria-expanded', 'false');
+ this.$triggers.attr('aria-expanded', 'false');
if (this.options.trapFocus) {
$('[data-off-canvas-content]').removeAttr('tabindex');
}