fix scroll

This commit is contained in:
Pete Matsyburka authored and Oleksandr Turchyn committed 2024-09-23 11:45:07 +03:00
1 parent 311c2b0e34
commit f7a8e4102b
1 file changed
+10 -2
+10 -2
View File
@@ -132,10 +132,18 @@ export default {
this.scrollInContainer(areaRef.$el)
} else {
const targetRect = areaRef.$refs.scrollToElem.getBoundingClientRect()
const root = this.$root.$el?.parentNode?.classList?.contains('ds') ? this.$root.$el : document.body
const rootRect = root.getBoundingClientRect()
const scrollEl = this.scrollEl || window
let rootRect = {}
if (this.scrollEl === document.documentElement) {
rootRect = this.scrollEl.getBoundingClientRect()
} else {
const root = this.$root.$el?.parentNode?.classList?.contains('ds') ? this.$root.$el : document.body
rootRect = root.getBoundingClientRect()
}
scrollEl.scrollTo({ top: targetRect.top - rootRect.top, behavior: 'smooth' })
}