Comments (5)
from ember-in-viewport.
@sairam1610 Do all your loaders have the same id
? If so, that hopefully is the issue (and not allowed according to the spec)!
If each loader does have different ids
, do you have a minimal example I can look at? We have a bunch of examples in the dummy app and tested quite well.
ember-in-viewport/tests/dummy/app/components/
from ember-in-viewport.
I have tested in my-class component
infinity.hbs
<div class="left">
<ul>
{{#each models as |val|}}
<div class="infinity-class-item">
<svg width="200" height="250" version="1.1" xmlns="http://www.w3.org/2000/svg">
{{{val}}}
</svg>
</div>
{{/each}}
</ul>
<MyClass @infinityLoad={{this.infinityLoad}} />
</div>
</div>
component.js
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class MyClass extends Component {
@service inViewport
@action
setupViewport() {
const loader = document.getElementById('loader');
const { onEnter } = this.inViewport.watchElement(loader, { viewportSpy: false });
onEnter(this.didEnterViewport.bind(this));
}
didEnterViewport() {
console.log("view port entered")
}
willDestroyElement() {
const loader = document.getElementById('loader');
this.inViewport.stopWatching(loader);
}
}
my-class.hbs
<div {{did-insert this.setupViewport}} id="loader" style="background-color: brown;">
Hello there from loader
</div>
from ember-in-viewport.
@sairam1610 I think I would need an example to test with up on github or twiddle that I can manually test to see what is wrong. If you don't mind.
from ember-in-viewport.
@snewcomer I am using the {{in-viewport}}
modifier and I couldn't figure out a way to call the onEnter
listener only once. I tried passing viewportSpy=false
to the modifier (even the default value should be false), the event seems to be firing every time when the element enters the viewport.
Is there an option to execute the onEnter
event once and then remove the event listener for the element when using the {{in-viewport}}
modifier?
Here is a twiddle for reference.
https://ember-twiddle.com/c318b2c50578bd588f399a09ebd61cb2?openFiles=templates.application%5C.hbs
from ember-in-viewport.
Related Issues (20)
- Changelog HOT 1
- Failing to load more if items dont fill the screen HOT 1
- Pass more data back to callbacks
- Running Very Slowly HOT 9
- onExit doesn't get fired on IE HOT 3
- TypeError: Cannot read property 'viewportConfig' of undefined HOT 4
- Test failure in Ember 3.20
- Use {{in-viewport}} modifier multiple times on a page only trigger the last one's callback HOT 2
- Lazy load rAf implementation HOT 3
- onEvent(callback) API doesn't work HOT 1
- Add enter/exit logging if enabled
- Bug in Ember 3.20 HOT 5
- onExit doesn't fire unless viewportSpy is enabled
- How to access didScroll using service method? HOT 1
- Safari/IOS Flicker Bug
- Update to ember-auto-import@2 HOT 2
- assign is deprecated
- Convert to v2 addon HOT 1
- Support % based rootMargin
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 ember-in-viewport.