Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy load images #143

Open
CrashLaker opened this issue Nov 12, 2020 · 1 comment
Open

Lazy load images #143

CrashLaker opened this issue Nov 12, 2020 · 1 comment

Comments

@CrashLaker
Copy link

Hi all,

When I use this plugin to pop out images all images get loaded upon rendering.

Is it possible to lazy load them?
What other options do you suggest?

@kluzny
Copy link

kluzny commented Dec 19, 2021

Here is what I'm doing:

  <popper trigger='clickToOpen'
          @show='isVisible = true'
          @hide='isVisible = false'
          ref='popper'
          :options="{
            placement: 'bottom',
          }">
    <div class='popper'>
      <grid-color-picker v-if='isVisible' @picked="picked"/>
    </div>
    <i slot='reference' class="fa fa-tint fa-lg" :style="coloredStyle" title="Click to select a color"></i>
  </popper>

So on the show event, I flag isVisible to true, then I use that to render my content. You may want to add a min-height to your image container to prevent it from jittering.

The advantage of this approach, is that there are no dom elements in all your popovers, until they become visible.

I'm using about 1000-5000 popovers using this approach, which seems to be the upper bound in terms of page performance.

Anymore than that and I'm going to have to do some dynamic list rendering or other magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants