I have a <ul>
element. It's CSS overflow property is scroll
.
I have several list elements in the list, such that there is a scrollbar.
<ul style="overflow: scroll; height: 100px;">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
...
<li></li> // how can I judge if this element is in the viewport?
</ul>
How can I determine if a specific list item is visible in that list?
Also, if it's not currently visible, what property can I use to make it scroll into view?
PS: No libraries, please (jQuery, MooTools, etc).