I have this situation in which I need to scroll an element into the viewport. The problem is that I don't know which element is scrollable. For example, in Portrait the body is scrollable and in Landscape its an other element (and there are more situation which change the scrollable element)
Now the question, given an element which needs to be scrolled into the viewport, what is the best way to find its first scrollable parent ?
I've setup a demo here. With the button you can toggle between two different situations
<div class="outer">
<div class="inner">
<div class="content">
...
<span>Scroll me into view</span>
</div>
</div>
</div>
The body is scrollable or .outer
Any suggestions ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…