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.

b-carousel-slide :img-src lazy-loading

See original GitHub issue

I would like to have my (dozens+) carousels images being lazy loaded rather than blocking rendering. I don’t know if it’s impossible or just undocumented (there is no *lazy* on carousel documentation) Any hint welcome.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
tmorehousecommented, Oct 21, 2017

B-Carousel-slide code is at https://github.com/bootstrap-vue/bootstrap-vue/blob/dev/lib/components/carousel-slide.vue

      <b-carousel-slide>
        <img slot="img" class="d-block img-fluid w-100" width="1024" height="480"
             src="https://lorempixel.com/1024/480/technics/5/" alt="image slot">
      </b-carousel-slide>

You can just replace <img ...> above with <b-img-lazy ...> but you should set the width and height of the original image on b-img-lazy so that the carousel will be sized correctly (as carousel itself doesn’t have a defined siz, and if a size for image is set, it only applies to the image specified via the img-src props. All of your slide images should be the same dimensions, and should have the fluid or fluid-grop prop set.

1reaction
tvldcommented, Dec 8, 2017

Seems that this works fine, no need for setInterval():

    methods: {
      onSlideStart (slide) {
        this.sliding = true
        // for laxy loading, we invoke scroll event (ignore Lint Error... it seem to work ok)
        /* global Event */
        window.dispatchEvent(new Event("scroll"))
      },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap Carousel Lazy Load - Stack Overflow
The simplest solution would be: <div id="carousel" class="carousel slide lazy-load" data-ride="carousel" data-interval="false"> <div ...
Read more >
Carousel | Components - BootstrapVue
When using img-src or img-blank on <b-carousel-slide> , you can set the image width and height via the img-width and img-height props on...
Read more >
Carousel load all slides | Quasar Framework Community
Hi! Is there a way to load all slides at render in a q-carousel instead of loading only when it shows for the...
Read more >
Lazy Loading Images – The Complete Guide - ImageKit.io
The general concept of lazy loading images in <img> tag; Trigger image load using Javascript events; Using Intersection Observer API to ...
Read more >
Lazy Loading Images with Vue.js Directives and Intersection ...
vue . In the component template, we'll use a figure tag that contains our image — the image tag itself will receive the...
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