Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export class Tabs extends Component {
// Update the variables with the new link and content

this._activeTabLink = tabLink;
this._content = document.querySelector(tabLink.hash);
if (tabLink.hash)
this._content = document.querySelector(tabLink.hash);
this._tabLinks = this.el.querySelectorAll('li.tab > a');
// Make the tab active
this._activeTabLink.classList.add('active');
Expand Down Expand Up @@ -160,8 +161,8 @@ export class Tabs extends Component {
this._activeTabLink.classList.add('active');

this._index = Math.max(Array.from(this._tabLinks).indexOf(this._activeTabLink), 0);
if (this._activeTabLink) {
this._content = document.querySelector(this._activeTabLink.hash);
if (this._activeTabLink && this._activeTabLink.hash) {
this._content = document.querySelector(this._activeTabLink.hash);
this._content.classList.add('active');
}
}
Expand All @@ -173,9 +174,11 @@ export class Tabs extends Component {

const tabsContent = [];
this._tabLinks.forEach(a => {
const currContent = document.querySelector(a.hash);
currContent.classList.add('carousel-item');
tabsContent.push(currContent);
if (a.hash) {
const currContent = document.querySelector(a.hash);
currContent.classList.add('carousel-item');
tabsContent.push(currContent);
}
});

// Create Carousel-Wrapper around Tab-Contents
Expand Down