Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
picascaz committed Apr 15, 2024
1 parent f2bd83d commit 308ca9a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/Home/ANewAgg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ const ANewAgg = () => {
tolerance: 10,
preventDefault: true,

onEnable(self) {
onEnable(self: any) {
allowScroll = false
scrollTimeout.restart(true)
let savedScroll = self.scrollY()
self._restoreScroll = () => self.scrollY(savedScroll)
document.addEventListener('scroll', self._restoreScroll, { passive: false })
},
onDisable: (self) => document.removeEventListener('scroll', self._restoreScroll),
onDisable: (self: any) => document.removeEventListener('scroll', self._restoreScroll),
})

intentObserver.disable()

function gotoPanel(index, isScrollingDown) {
function gotoPanel(index: number, isScrollingDown: boolean) {
if ((index === swipePanels.length && isScrollingDown) || (index === -1 && !isScrollingDown)) {
intentObserver.disable() // resume native scroll
return
}
allowScroll = false
scrollTimeout.restart(true)

let target = isScrollingDown ? swipePanels[currentIndex] : swipePanels[index]
let target: any = isScrollingDown ? swipePanels[currentIndex] : swipePanels[index]

gsap.to(target, {
yPercent: isScrollingDown ? -100 : 0,
Expand Down Expand Up @@ -210,7 +210,7 @@ const ANewAgg = () => {
},
]

const scrollToPanel = (index) => {
const scrollToPanel = (index: number) => {
const targetElement = document.getElementById(`panel-${index}`)

if (targetElement) {
Expand Down

0 comments on commit 308ca9a

Please sign in to comment.