Comments (9)
I think you'll have to change the infiniteScrollDistance. I use 0.8 and thats about 75% down the page. As for the scroll up/down, in 0.1.3 they are differentiated.
from ngx-infinite-scroll.
Thanks @tallkid24. Both of these already updated angular2-infinite-scroll 0.1.4.
This plunker uses [infiniteScrollDistance]="2"
This plunker uses [infiniteScrollDistance]="0.8"
Right now both of them only run onScrollDown()
one time in the beginning when you scroll.
But still how can I run onScrollDown()
only when scroll down near the bottom?
from ngx-infinite-scroll.
Hi @orizens , would you mind adding a working simple plunker demo in the readme Showcase Examples part? So people can start quickly.
Some demo like this plunker, automatically add another 20 items when scroll down near the bottom. (But right now it won't work well)
Thanks
from ngx-infinite-scroll.
@hongbo-miao
you should use this style:
.search-results {
height: 100%;
overflow: scroll;
}
since the way you constructed the directive is to listen to the window scroll and the the actual div.
if you want it to scroll relatively to the div, you should set [scrollWindow]="false"
from ngx-infinite-scroll.
@hongbo-miao
i forked your plunkr and added to the demo.
thanks.
from ngx-infinite-scroll.
@hongbo-miao also,
I see an issue where the immediate scroll, scroll in the beginning.
I think that the issue that you describe should be in defined in a new issue thread.
from ngx-infinite-scroll.
@orizens thanks! That is awesome!
That "issue" is because of I set immediateCheck
to true I guess..
from ngx-infinite-scroll.
great.
ok. i'll update the examples and docs for this as well.
Thanks!
from ngx-infinite-scroll.
Hello,
I think I have found a little workaround that fixes this issue by setting the infiniteScrollThrottle to 0, and make your own throttling method.
So here's how I did it:
in the HTML side, use these attributes:
[infiniteScrollThrottle]="0"
(scrolled)="loadMore()"
on the other hand, in the ts file, make your own throttling condition in the loadMore() function:
loading = false;
loadingThrottle = 300;
loadMore() {
if (!this.loading) {
this.loading = true;
window.setTimeout(() => {
// your loading logic here..
this.loading = false;
}, this.loadingThrottle);
}
}
Hope this helps.
from ngx-infinite-scroll.
Related Issues (20)
- x-ray blocks npm because license info is missing
- Data is only visible after scrolling again on iOS
- Angular 14 HOT 1
- alwaysCallback is not working in version 13.0.0
- Missing target version for angular 6+ HOT 1
- how do you set the [horizontal] value based on the width of the parent?
- Support Angular@15
- Are you still maintaining this library? HOT 2
- Can ngx-infinite-scroll work with mat-select / mat-option HOT 1
- Shipping without @scarf/scarf HOT 1
- Angular v16 support HOT 3
- Facing issue in ngx-infinite-scroll version 16.0.0 HOT 2
- error NG6002: 'InfiniteScrollModule' does not appear to be an NgModule class. HOT 5
- Scroll events not fired when using Chrome devtools device mode
- Adding new standalone APIs HOT 1
- Scroll events not fired with angular 16 HOT 2
- Repeated events onScrollDown HOT 1
- Trigger event of no scrollbar is present HOT 2
- Upgrade to Angular 17 ? HOT 8
- After reloading the data, the scrolling event becomes invalid HOT 1
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 ngx-infinite-scroll.