I'm loading elements via AJAX. Some of them are only visible if you scroll down the page.
Is there any way I can know if an element is now in the visible part of the page?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
This answer in Vanilla:
WebResourcesDepot wrote a script to load while scrolling that uses jQuery some time ago. You can view their Live Demo Here. The beef of their functionality was this:
This should do the trick:
Simple Utility Function This will allow you to call a utility function that accepts the element you're looking for and if you want the element to be fully in view or partially.
Usage
Modified the accepted answer so that the element has to have it's display property set to something other than "none" to quality as visible.
I prefer using jQuery expr
so you can use it this way
You can easly add such code inside
scroll
event function etc. to check it everytime user will scroll the view.