Skip to content

inView.js is a simple jQuery function that can quickly detect if an element or group of elements is visible in the main viewport (window object). It will consider element’s position and dimensions, compared to dimension and scroll position of window.

License

Notifications You must be signed in to change notification settings

lukac-dejan/inView.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

inView.js

This is a jQuery function which allows us to quickly check if an element is within the browsers visual viewport (window object).

Documentation

inView.js is a function that allows you to select element or group of elements on a web page and track their visibility as you scroll or resize the page.

Since this is a simple plugin, the usage is simple too. First, add the inView.js to your document along with jQuery library:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>

<script type="text/javascript" src="_js/jquery.inView.js"></script>

After that all you need to do is assign a class named .trackInView to all of the elements on the page that you want to track. Once it's done, inView.js will execute on every onresize and onscroll event and assign class named .inView if the element is in the viewport or .notInView if it's not.

Limitations

This function will consider element’s position and dimensions, compared to dimension and scroll position of window. It will NOT check if the element is hidden using css, or positioned behind another object using z-index.

About

inView.js is a simple jQuery function that can quickly detect if an element or group of elements is visible in the main viewport (window object). It will consider element’s position and dimensions, compared to dimension and scroll position of window.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published