NiclO1337 / pp4-banana-palace

A website for a restaurant specializing in delicious recipes using bananas. Fourth portfolio project with Code Institute.
0 stars 1 forks source link

[BUG] scrollTop #45

Closed NiclO1337 closed 7 months ago

NiclO1337 commented 7 months ago

Describe the bug The document.body.scrollTop is not working properly, if scrolling down once and up again, it flickers between up and down settings rapidly for a few seconds.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'index page'
  2. Scroll down 1 step
  3. Scroll up 1 step
  4. See error

Expected behavior Smooth transition

NiclO1337 commented 7 months ago

Conclusion: Since using slow transition on height of header, the scrollbar changes size also slowly during the transition. Which means that if scrolling up again will cause the scrollbar to jump up and down over the treshhold of the function causing it to go on and off rapidly. Solution: Force scrollTop to be exactly 0 when scrolling up