Comments (5)
For now I'm just manually checking to see if the viewport is scrolled past the element. It's a simple situation being that the element in question occupies the very top of the body. I'd love to know a better approach for future situations though.
$(window).on('load', function () {
if ( $(window).scrollTop() > $header.height() ) {
activate();
}
});
from jquery.inview.
I second this.
A nice way would also be if the actual code to check if an element is in view would be populated, so one could use it from outside the event.
from jquery.inview.
Btw ryan, when you trigger the event manually the whole inview-logic is bypassed – hence you need to pass the inview parameter yourself.
Since you don't pass anything, your first condition will never be satisfied, and activate() will be called.
from jquery.inview.
@ryanburnette I just commited a pull request that fixes this issue: 1e4bf03
Actually the inview event should be fired initially as well, but due to a mistake in code only for elements that are or have been in view.
from jquery.inview.
@andypillip Thanks for the solution. Manually patching the code, fixed the problem for me.
from jquery.inview.
Related Issues (20)
- delay inview HOT 1
- Bind working in browser but not is mobile devices.
- visiblePartX and visiblePartY no longer available HOT 1
- Uncaught TypeError: Cannot read property 'appendChild' of undefined HOT 1
- Listening on body does not work correctly.
- Баг при удаление класса элемента выходящего из зоны видимости флаг видимости не корректно возвращается
- Uncaught Type Error:
- Reinitialization HOT 1
- change links to blog entry to this
- Uncaught TypeError: $ is not a function HOT 1
- Uncaught TypeError: $(...).easyResponsiveTabs is not a function
- Making This Work in an iFrame HOT 1
- Delay animation? HOT 1
- Confused by out of view vs inview priority
- Issue with $(this) and inView
- This plugin could benefit form using the intersection observer API HOT 1
- Add offset? HOT 1
- Sequential loading?
- Image blocking using the uBlock Origin extension
- JavaScript console messages "Uncaught TypeError: $"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery.inview.