Loaded event triggering on every scroll event
See original GitHub issueI’m using the loaded adapter alongside vue-router. I’m finding that on initial page load the loaded event is triggered once per image, which is expected. After changing routes I find that the loaded event is triggered on every scroll event for every visible image, even if the image has already loaded. Setup like this:
Vue.use(VueLazyload, {
preLoad: 1.8,
error: false,
loading: false,
attempt: 1,
supportWebp: false,
adapter: {
loaded({ el }) {
console.log(el);
},
},
});
Is this expected behaviour?
Online example here: http://requirebin.com/?gist=rdunk/1371389794270c9672bb15f4e24d40c3
Try changing route a few times and then scrolling, should see the events in the console.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
How to trigger an on scroll event without scrolling
If you want to fire a scroll event, just literally scroll to where you already are by typing window.scrollTo(window.scrollX, window.scrollY); in ...
Read more >JavaScript Scroll Events, Event Throttling & Passive Events
You can trigger the scroll events in the following ways, for example: ... The scrollX and scrollY are 0 if the document hasn't...
Read more >Document: scroll event - Web APIs - MDN Web Docs - Mozilla
The scroll event fires when the document view has been scrolled. To detect when scrolling has completed, see the Document: scrollend event.
Read more >onscroll Event - W3Schools
The onscroll event occurs when an element's scrollbar is being scrolled. Tip: use the CSS overflow style property to create a scrollbar for...
Read more >.scroll() | jQuery API Documentation
The scroll event is sent to an element when the user scrolls to a different place in the element. It applies to window...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fawadaslam1993 Managed to dig it out. This is just a replacement for the component, not the directive, so not sure if it will do what you need it to do.
Hope it helps.
https://gist.github.com/rdunk/98c9c2a80dace8e73472b81e3e9ce97b
Thanks. I’ll try 😃