question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Logic for triggering scrolled callback

See original GitHub issue

I am opening this issue because I wanted to discuss an unusual behaviour, I encountered while make an angular2+ app using ngx-infinite-scroll.
So basically, I was writing a chrome extension where I was lazy-loading rows from websql. Everything was working fine until I was using enough number of elements to make container scrollable at first fetch of rows from websql. But when I tried fetching less elements (just enough to make the container unscrollable at first load), scrolled function wasn’t called. The apparent reason for this could be - the `scroll’ event didn’t fire as the container was not scrollable.
Let me give an example so that you can reproduce it.

  1. A container takes 5 child elements to make the Scroll show up on it.
  2. If I keep the child elements more than 5. The scroll shows up and directive works fine meaning i am able to load all the rows when I scroll down.
  3. If I keep the child elements less than 5 ie 4. The scroll don’t show up and Scroll event is never called. Here is the plunker:
    https://embed.plnkr.co/k1jr5g/

To reproduce the behavior, Go to app.ts, declare sum = 5 and rerun the plunker, You will see component stops loading the items after just 5 items. If you use sum = 15, the directive will work fine.
Hopefully, the developer will resolve the issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Vikasg7commented, Jan 2, 2018

@orizens here is a link to swf file that you can play.
https://www.dropbox.com/s/l9e6e67kshtfxv7/ngx-infinite-scroll.swf?dl=0

I tried 0.8.0 and found to be not good. It’s not calling Scrolled handler in either of both cases.

0reactions
orizenscommented, Feb 28, 2018

@juliamarjana please open a separate issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript Scroll Events, Event Throttling & Passive Events
When you scroll a document or an element, the scroll events fire. You can trigger the scroll events in the following ways, for...
Read more >
Trigger event when user scroll to specific element - with jQuery
and I want to trigger an alert when the user scrolls to the h1, or has it in it's browser's view. $('#scroll-to').scroll(function() {...
Read more >
Scrolling - The Modern JavaScript Tutorial
The scroll event allows reacting to a page or element scrolling. There are quite a few good things we can do here. For...
Read more >
The “scroll” event JavaScript Tutorial | window.onscroll
Learn about JavaScript's scroll event in this coding tutorial. I show you two ways to listen to scroll events and talk about why...
Read more >
Trigger a Function when Scrolling to an Element in React with ...
Learn how to trigger functionality whenever someone scrolls to an HTML element in React with the browser's Intersection Observer API.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found