scroll-tab-panel component now has 'active' attribute on panel visible in viewport
This commit is contained in:
sairaj mote 2021-04-07 20:09:29 +05:30
parent 41954e92e0
commit 8718ae1aa5
4 changed files with 19 additions and 3 deletions

View File

@ -3825,12 +3825,17 @@ customElements.define('scroll-tab-panels', class extends HTMLElement {
}
this.debounceTimeout = setTimeout(() => {
this.fireEvent(entry.target.dataset.index)
}, 300);
if (this.activePanel)
this.activePanel.removeAttribute('active')
this._assignedElements[entry.target.dataset.index].setAttribute('active', '')
this.activePanel = this._assignedElements[entry.target.dataset.index]
}, 100);
}
})
},
{
threshold: 0.8
threshold: 0.8,
root: this.tabPanels
})
this.tabPanels.addEventListener('slotchange', e => {
this._assignedElements = this.tabPanelsSlot.assignedElements()

View File

@ -738,6 +738,12 @@ scroll-tab-panels {
scroll-tab-panels > * {
min-height: max(24rem, 50vh);
margin-bottom: 6rem;
opacity: 0.4;
-webkit-transition: opacity 0.6s;
transition: opacity 0.6s;
}
scroll-tab-panels > [active] {
opacity: 1;
}
.auto-grid-layout {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -598,6 +598,11 @@ scroll-tab-panels{
& > *{
min-height: max(24rem, 50vh);
margin-bottom: 6rem;
opacity: 0.4;
transition: opacity 0.6s;
}
& > [active]{
opacity: 1;
}
}
.auto-grid-layout{