mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-15 01:33:54 +00:00
scroll top fixies
This commit is contained in:
parent
e9744cbc79
commit
a5c74c4372
@ -216,11 +216,13 @@ export default defineComponent({
|
||||
if (element.isIntersecting && element.intersectionRatio > 0) {
|
||||
setTimeout(() => {
|
||||
currentItem.value = element.target.id;
|
||||
console.log('219-CurrentEl:',currentItem.value);
|
||||
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
});
|
||||
firstItem.value = document?.getElementById(`tabitem${graphs[0].i}`)
|
||||
firstItem.value = document?.getElementById(`tabitem${graphs[0].i}`);
|
||||
document.querySelectorAll(".tabitem").forEach((element) => {
|
||||
observer.observe(element);
|
||||
});
|
||||
@ -302,13 +304,14 @@ export default defineComponent({
|
||||
);
|
||||
}
|
||||
function scrollToFirstGraph(scrollUp: boolean) {
|
||||
const graphs = JSON.parse(JSON.stringify(dashboardStore.currentTabItems));
|
||||
const thereisNextEl = document?.getElementById(`${currentItem.value}`) !== null
|
||||
if (scrollUp && !thereisNextEl) {
|
||||
const noNextEl =
|
||||
document?.getElementById(`${currentItem.value}`)?.nextElementSibling === null;
|
||||
if (scrollUp && noNextEl) {
|
||||
console.log(firstItem.value)
|
||||
firstItem.value.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
document.body.addEventListener("click", handleClick, false);
|
||||
watch(
|
||||
() => dashboardStore.activedGridItem,
|
||||
@ -327,27 +330,26 @@ export default defineComponent({
|
||||
);
|
||||
onMounted(() => {
|
||||
tabObserveContainer?.value?.addEventListener("scroll", (e: Event) => {
|
||||
const prevScrollY = tabObserveContainer.value.scrollTop
|
||||
if (refScrollTimeOut.value) {
|
||||
clearTimeout(refScrollTimeOut.value)
|
||||
clearTimeout(refScrollTimeOut.value);
|
||||
}
|
||||
// console.log("WindowScrollY Outside:", tabObserveContainer.value);
|
||||
refScrollTimeOut.value = window.setTimeout(() => {
|
||||
if (
|
||||
tabObserveContainer.value?.scrollTop > currentScrollY.value ||
|
||||
tabObserveContainer.value?.scrollTop === currentScrollY.value
|
||||
) {
|
||||
// console.log('prevScroll',prevScrollY, 'currentID:', currentItem.value);
|
||||
if(tabObserveContainer.value?.scrollTop > currentScrollY.value ||
|
||||
tabObserveContainer.value?.scrollTop === currentScrollY.value)
|
||||
{
|
||||
console.log(tabObserveContainer.value?.scrollTop, currentScrollY.value)
|
||||
setTimeout(() =>{
|
||||
scrollToFirstGraph(true)
|
||||
console.log("Scrolled Down!")
|
||||
},200)
|
||||
// console.log("scrolled Down:", document?.getElementById(`${currentItem.value}`)?.nextElementSibling, firstItem.value)
|
||||
}
|
||||
currentScrollY.value = tabObserveContainer.value?.scrollTop
|
||||
console.log("CurrentScrollY:", document?.getElementById(`${currentItem.value}`));
|
||||
|
||||
currentScrollY.value = tabObserveContainer.value?.scrollTop
|
||||
}, 100);
|
||||
});
|
||||
tabRef?.value["parentElement"]?.classList?.toggle("item");
|
||||
if (dashboardStore.fullView) {
|
||||
// console.log("Tab Osbercve:", tabObserveContainer);
|
||||
}
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
observeItems(true);
|
||||
|
Loading…
Reference in New Issue
Block a user