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.

Does not work with Perfect Scrollbar plugin.

See original GitHub issue

Hi When page is first loaded the images are downloaded but when I scroll down the images are not downloading. Seems like event is not firing.

<div class="content d-flex flex-wrap"  style="position: relative">
       <div class="brick" *ngFor="let employee of employees">
         <div class="employeeBox animated zoomIn " [routerLink]="['/employees', employee.id]">
           <div class="employeePhoto">
             <img [defaultImage]="'assets/icons/user.svg'"  [lazyLoad]="employee.imgUrl">
           </div>
           <div class="employeeInfo">
             <p>{{employee.name}}</p>
           </div>
         </div>
       </div>
     </div>
</div>

Angular version: 5.1.2 “ng-lazyload-image”: “^3.4.2”, Hope you solve problem. Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sapierenscommented, Jan 11, 2018

I managed to get it to work like this - https://stackblitz.com/edit/angular-zovu45 I’m not sure if that’s the best solution though.

It’s also possible to solve it like @tjoskar suggested in https://github.com/tjoskar/ng-lazyload-image/issues/275#issuecomment-356853681, but you’d have to use perfect-scrollbar as a directive instead of a component for it to work (https://github.com/zefoy/ngx-perfect-scrollbar#installing-and-usage under DIRECTIVE USAGE).

1reaction
vugar005commented, Jan 11, 2018

@sapierens @tjoskar. Thanks. Solved the issue by adding Scroll Target. But the plugin is not compatible with perfect scrollbar. in TS this.scroll = document.getElementById('main_content');

<perfect-scrollbar id="main_content">
  <div class="content d-flex flex-wrap"  style="position: relative"  #sc>
         <div class="brick" *ngFor="let employee of employees">
           <div class="employeeBox animated zoomIn " [routerLink]="['/employees', employee.id]">
             <div class="employeePhoto">
               <img    [defaultImage]="'assets/icons/user.svg'"
                       [lazyLoad]="employee.imgUrl"
                       [useSrcset]="true"
                       [scrollTarget]="scroll"
               >
             </div>
             <div class="employeeInfo">
               <p>{{employee.name}}</p>
             </div>
           </div>
         </div>
       </div>
</perfect-scrollbar>

Changed perfect scrollbar to div with overflow auto and it works as expected but I want to keep perfect scrollbar. So what I did is: When I console this.scroll

<perfect-scrollbar id="main_content"  >
   <div style="position:static"  class="ps" ng-reflect-disabled=false> ... </div>
</perfect-scrollbar>

So by assigning this.scroll to document.getElementById(‘main_content’).children[0]; Problem is fully solved. Thanks for help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Perfect Scrollbar
Minimalistic but perfect custom scrollbar plugin. Create scrollbar without manipulation on DOM tree, any change on the design layout, and much more.
Read more >
perfect-scrollbar not work - Stack Overflow
i have a list of items inside a ul, wrapped on a div, i am using this plugin: http ...
Read more >
perfect scrollbar doesnt work in a div with sidenav
I added a perfectscrollbar in a div. But sidenav doesnt work now. Can u fix it? And scrollbar design is not good. İt...
Read more >
perfect-scrollbar - npm
Minimalistic but perfect custom scrollbar plugin. Latest version: 1.5.5, last published: a year ago. Start using perfect-scrollbar in your ...
Read more >
Tiny JavaScript Plugin For Beautifying Scrollbar - jQuery Script
perfect -scrollbar is a lightweight JavaScript plugin that allows you to ... 28, // When set to true, the scroll bar in X...
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