Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

lukac-dejan/inView.js

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
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

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.