Home Scroll up to Load More Data in angular1
Reply: 1

Scroll up to Load More Data in angular1

Harmanpreet Singh
1#
Harmanpreet Singh Published in 2018-01-13 06:03:36Z

I want to add scroll up to load more data in div. I want to implement it on message detail screen where user can scroll up to load more message.

document.getElementById("myDIV").addEventListener("scroll", myFunction);

function myFunction() {
    if (document.getElementById("myDIV").scrollTop === 0) {
      // call api to fetch data
    }
}

I have implemented this it's working fine. But evet fire multiple time. If i have to call event only one time.

Claies
2#
Claies Reply to 2018-01-13 19:33:59Z

Attach onscroll event handler on div first then use it like this:

document.getElementById("myDIV").addEventListener("scroll", myFunction);

function myFunction() {
    if (document.getElementById("myDIV").scrollTop === 0) {
      // call api to fetch data
    }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.396639 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO