Marian Rick Marian Rick - 1 year ago 137
Javascript Question

Detect if is in viewport using verge

I consider using verge by ryanve to detect wether some elements appear to be inside the current viewport.

As I did not find any tutorials on how to use verge, I wanted to try it out for myself. As a very basic example I want to use

to detect wether my image is inside the viewport or not and manipulate it.

I have tried a basic example, which does not work:

if(verge.inViewport(target)) {;


Answer Source

The code does actually work, like stated out by @AdamAzad in the comments:

if(verge.inViewport(target)) {;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download