});
});
}
-
- //use browser to open a tab, if it exists in this tabset
- if (_this.options.deepLink) {
- var anchor = window.location.hash;
- //need a hash and a relevant anchor in this tabset
- if(anchor.length) {
- var $link = $elem.find('[href$="'+anchor+'"]');
- if ($link.length) {
- _this.selectTab($(anchor));
-
- //roll up a little to show the titles
- if (_this.options.deepLinkSmudge) {
- $(window).load(function() {
- var offset = $elem.offset();
- $('html, body').animate({ scrollTop: offset.top }, _this.options.deepLinkSmudgeDelay);
- });
- }
--
- /**
- * Fires when the zplugin has deeplinked at pageload
- * @event Tabs#deeplink
- */
- $elem.trigger('deeplink.zf.tabs', [$link, $(anchor)]);
- }
- }
- }
});
+
if(this.options.matchHeight) {
var $images = this.$tabContent.find('img');
}
}
- var $link = this.$element.find('[href="'+anchor+'"]');
+ //current context-bound function to open tabs on page load or history popstate
+ this._checkDeepLink = () => {
+ var anchor = window.location.hash;
+ //need a hash and a relevant anchor in this tabset
+ if(anchor.length) {
++ var $link = this.$element.find('[href$="'+anchor+'"]');
+ if ($link.length) {
+ this.selectTab($(anchor), true);
+
+ //roll up a little to show the titles
+ if (this.options.deepLinkSmudge) {
+ var offset = this.$element.offset();
+ $('html, body').animate({ scrollTop: offset.top }, this.options.deepLinkSmudgeDelay);
+ }
+
+ /**
+ * Fires when the zplugin has deeplinked at pageload
+ * @event Tabs#deeplink
+ */
+ this.$element.trigger('deeplink.zf.tabs', [$link, $(anchor)]);
+ }
+ }
+ }
+
+ //use browser to open a tab, if it exists in this tabset
+ if (this.options.deepLink) {
+ this._checkDeepLink();
+ }
+
this._events();
}
idStr = `#${idStr}`;
}
- var $target = this.$tabTitles.find(`[href="${idStr}"]`).parent(`.${this.options.linkClass}`);
+ var $target = this.$tabTitles.find(`[href$="${idStr}"]`).parent(`.${this.options.linkClass}`);
- this._handleTabChange($target);
+ this._handleTabChange($target, historyHandled);
};
/**
* Sets the height of each panel to the height of the tallest panel.
.find(`.${this.options.panelClass}`)
.css('height', '')
.each(function() {
+
var panel = $(this),
- isActive = panel.hasClass(`${this.options.panelActiveClass}`);
+ isActive = panel.hasClass(`${_this.options.panelActiveClass}`); // get the options from the parent instead of trying to get them from the child
-
+
if (!isActive) {
panel.css({'visibility': 'hidden', 'display': 'block'});
}