|
|
|
@ -8,51 +8,51 @@ class scroll { |
|
|
|
|
const height = Number(window.innerHeight); |
|
|
|
|
const scrollY = Number(window.scrollY); |
|
|
|
|
if (index === 1) { |
|
|
|
|
if (prevScroll === 0) { |
|
|
|
|
if (scrollY === 0) { |
|
|
|
|
return 0; |
|
|
|
|
}else |
|
|
|
|
if (prevScroll > 0 && prevScroll <= height) { |
|
|
|
|
return -prevScroll; |
|
|
|
|
if (scrollY > 0 && scrollY <= height) { |
|
|
|
|
return -scrollY; |
|
|
|
|
} |
|
|
|
|
if (prevScroll > height) { |
|
|
|
|
if (scrollY > height) { |
|
|
|
|
return -height; |
|
|
|
|
} |
|
|
|
|
} else if (index === 2) { |
|
|
|
|
if (prevScroll === 0) { |
|
|
|
|
if (scrollY === 0) { |
|
|
|
|
return height; |
|
|
|
|
} |
|
|
|
|
if (prevScroll > 0 && prevScroll <= height) { |
|
|
|
|
return height - prevScroll; |
|
|
|
|
if (scrollY > 0 && scrollY <= height) { |
|
|
|
|
return height - scrollY; |
|
|
|
|
} |
|
|
|
|
if (prevScroll > 10 * height) { |
|
|
|
|
if (scrollY > 10 * height) { |
|
|
|
|
return -1 * height; |
|
|
|
|
} |
|
|
|
|
} else if (index === 3) { |
|
|
|
|
if (prevScroll <= 3.5 * height) { |
|
|
|
|
if (scrollY <= 3.5 * height) { |
|
|
|
|
return height; |
|
|
|
|
} |
|
|
|
|
if (prevScroll > 3.5 * height && prevScroll <= 4 * height) { |
|
|
|
|
return 4 * height - prevScroll; |
|
|
|
|
if (scrollY > 3.5 * height && scrollY <= 4 * height) { |
|
|
|
|
return 4 * height - scrollY; |
|
|
|
|
} |
|
|
|
|
if (prevScroll > 10 * height) { |
|
|
|
|
if (scrollY > 10 * height) { |
|
|
|
|
return -height; |
|
|
|
|
} |
|
|
|
|
} else if (index === 4) { |
|
|
|
|
if (prevScroll <= 5 * height) { |
|
|
|
|
if (scrollY <= 5 * height) { |
|
|
|
|
return height; |
|
|
|
|
} else if (prevScroll > 5 * height && prevScroll < 6 * height) { |
|
|
|
|
return 6 * height - prevScroll; |
|
|
|
|
} else if (scrollY > 5 * height && scrollY < 6 * height) { |
|
|
|
|
return 6 * height - scrollY; |
|
|
|
|
} |
|
|
|
|
if (prevScroll === 10 * height) { |
|
|
|
|
if (scrollY === 10 * height) { |
|
|
|
|
return -height; |
|
|
|
|
} |
|
|
|
|
} else if (index === 5) { |
|
|
|
|
if (prevScroll <= 7.3 * height) { |
|
|
|
|
if (scrollY <= 7.3 * height) { |
|
|
|
|
return height; |
|
|
|
|
} else if (prevScroll > 7.3 * height && prevScroll < 8.3 * height) { |
|
|
|
|
return 8.3 * height - prevScroll; |
|
|
|
|
} else if (scrollY > 7.3 * height && scrollY < 8.3 * height) { |
|
|
|
|
return 8.3 * height - scrollY; |
|
|
|
|
} |
|
|
|
|
if (prevScroll === 10 * height) { |
|
|
|
|
if (scrollY === 10 * height) { |
|
|
|
|
return -height; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|