coryrylan / ngx-lite

:package: A collection of lightweight Angular libraries in a single mono repo
https://ngxlite.com
MIT License
138 stars 21 forks source link

Use Intersection Observer API for in-viewport module #16

Open xmlking opened 5 years ago

xmlking commented 5 years ago

Is your feature request related to a problem? Please describe.

use Intersection Observer API like

https://github.com/TradeMe/ng-defer-load

for in-viewport module

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered use Intersection Observer API to check if an element is in viewport and falls back to scroll detection mechanism for unsupported browsers.

Additional context Add any other context or screenshots about the feature request here.

coryrylan commented 5 years ago

Agree this would be a great improvement!

xmlking commented 5 years ago

here is my initial implementation https://github.com/xmlking/ngx-starter-kit/tree/develop/libs/ngx-utils/src/lib/directives/in-viewport

demo https://xmlking.github.io/ngx-starter-kit/dashboard/experiments/viewport