How to get if an element is in view?
<p>In my application I want to use:</p>

<pre><code>element.scrollIntoView()
</code></pre>

<p>To make sure the element is inside the viewport, it works.</p>

<p>However, I found that it may cause some problem, for example when an element is inside the viewport and then I set it 'into view'. Then the scroll bar will move accordingly, this is not what I expected.</p>

<p>So, I want to make sure the element is not inside the viewport, then call the <code>scrollIntoView</code>.</p>

<p>How to get if the element is inside the viewport or not?</p>
