1

I'm designing a mobile webpage and the following piece of CSS HAS to be present in order for the position: fixed items to work properly:

html, body { height: 100%; overflow: auto; }

However, after adding overflow: autothe scrollTo() method doesn't work anymore - no scrolling happens. Why is that? How do I fix it?

1 Answer 1

1

I ran into similar issues with needing overflow: auto; but it was because I was previously scrolling the window rather than the element I wanted to scroll. Switching to the element worked with updated positioning.

So instead of:

$(window).scrollTo()

I switched to:

$('#element').scrollTo()

And that worked. I'm not sure if you're in exactly the same situation but it may help?

Sign up to request clarification or add additional context in comments.

2 Comments

This solution doesn't work for me, because I need to scroll the entire window.
Ah. If using fixed positioning for certain element(s), can you not have a wrapper around the elements that will scroll and target that with scrollTo? It may not be possible though, depending on your markup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.