Onion
Onion

Reputation: 1832

JQuery scrollTo with overflow: auto

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?

Upvotes: 1

Views: 524

Answers (1)

Dave McNally
Dave McNally

Reputation: 43

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?

Upvotes: 1

Related Questions