Well, it doesn't exactly break - If you have different cases you will have to adjust the logic to fit those different cases.   You could also use a ternary operator for the start - check if the section's scrollHeight is bigger or smaller than e.g. the window's height and set the start depending on that.   start: section.scrollHeight <= window.innerHeight ? 'top top' : 'bottom bottom'   See the Pen OJxwZME by akapowl (@akapowl) on CodePen 
    • Like
    4