wrking on scroll up at last item

This commit is contained in:
Peter Olu 2022-04-24 09:28:24 +01:00
parent a082fce977
commit 949a7feb97

View File

@ -204,7 +204,19 @@ export default defineComponent({
function scrollToGraph(e: any) { function scrollToGraph(e: any) {
document?.getElementById(`tabitem${e}`)?.scrollIntoView(); document?.getElementById(`tabitem${e}`)?.scrollIntoView();
} }
function debounce(func: any, wait: number, immediate: boolean) {
let timeout: any;
return function () {
let context = this,
args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function () {
timeout = null;
if (!immediate) func.apply(context, args);
}, wait);
if (immediate && !timeout) func.apply(context, args);
};
}
function observeItems(kill = false) { function observeItems(kill = false) {
const observer = new IntersectionObserver((entries) => { const observer = new IntersectionObserver((entries) => {
entries.forEach( entries.forEach(
@ -318,9 +330,12 @@ export default defineComponent({
} }
); );
onMounted(() => { onMounted(() => {
window.addEventListener("scroll", (e) => {
console.log(e);
});
tabRef?.value["parentElement"]?.classList?.toggle("item"); tabRef?.value["parentElement"]?.classList?.toggle("item");
if (dashboardStore.fullView) { if (dashboardStore.fullView) {
console.log("Tab Osbercve:", tabObserveContainer); // console.log("Tab Osbercve:", tabObserveContainer);
} }
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
@ -372,6 +387,10 @@ export default defineComponent({
.scroll-snap-container::-webkit-scrollbar { .scroll-snap-container::-webkit-scrollbar {
display: none; display: none;
} }
.scroll-snap-container {
-ms-overflow-style: none;
scrollbar-width: none;
}
.tabitem { .tabitem {
scroll-snap-align: start; scroll-snap-align: start;
height: 100%; height: 100%;