Viewport - A simple way to check elements in viewport or not

Viewport – A simple way to check elements in viewport or not

Viewport is a jQuery plugin to help people detect the element is currently inside, outside or partly in viewport.

Viewport - A simple way to check elements in viewport or not

It just a simple view-port detection script to catch elements by using scroll event, but in some situations it may not work that caused by parent bounds, children margin, offset height, etc. If your app body content is quite complex like playing a lot of tricky margin and inline JavaScript positions, Viewport is not suitable for you.

You may just need to playing around with the pseudo selectors such as $(‘:in-viewport’), above-the-viewport, below-the-viewport, left, right, partly-above, partly-below, partly-left, partly-right and have-scroll.

only include 6KB viewport.js and jQuery core to get started, that’s all for today, enjoy the goodies!

Thanks Anton Zinoviev who created this viewport detect script for free and open source.

Viewport is released under MIT license.

Cost: FREE
Requirement: jQuery
Source: Read more about Viewport

Share This Post

Comments