Archive for the ‘JavaScript’ Category

scrollIntoView, but only if out of view

August 26th, 2009

On browsers such as Firefox, the scrollIntoView function silently returns without action if the element in question is already on the screen. However, in IE6, and perhaps other browsers, it causes the screen to scroll even if it is already in view. To workaround this, and only call the scrollIntoView function if the element in question is out of view, I wrote the following helper method — scrollIntoViewIfOutOfView.

Read the rest of this entry »