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

autoWidth + lazyLoad #33

Closed
eiszfuchs opened this issue May 5, 2014 · 3 comments
Closed

autoWidth + lazyLoad #33

eiszfuchs opened this issue May 5, 2014 · 3 comments

Comments

@eiszfuchs
Copy link

OwlCarousel seems to have to load all images before being able to calculate widths while autoWidth is set to true. Maybe I'm just doing it wrong.
My setup basically looks like this:

<div class="owl-carousel">
    <div style="width: 500px;">
        <span class="caption">Caption A</span>
        <img class="owl-lazy" width="500" height="200" data-src="large-image.a.jpg" alt="">
    </div>

    <div style="width: 700px;">
        <span class="caption">Caption B</span>
        <img class="owl-lazy" width="700" height="200" data-src="large-image.b.jpg" alt="">
    </div>

    <div style="width: 1200px;">
        <span class="caption">Caption C</span>
        <img class="owl-lazy" width="1200" height="200" data-src="large-image.c.jpg" alt="">
    </div>

    <div style="width: 300px;">
        <span class="caption">Caption D</span>
        <img class="owl-lazy" width="300" height="200" data-src="large-image.d.jpg" alt="">
    </div>
</div>

The thing is that I already know how big my images are and don't have to wait for images to load. Also, I'm resizing images as the browser's window is resized, but that is working like it's supposed to do once the slider is initialised.
Is there a way to tell it to rely on widths I already provide?

@CREEATION
Copy link

fix plx 👍

@eiszfuchs
Copy link
Author

This works, yes!
It also fixes a problem I had with cases where several images are broken (which is a problem on my side), those would render the slider unusable.

Isn't $el.children().eq(0).width() the same as $el.children().width(), as it already takes the first element of the result? :)

@ghost ghost closed this as completed May 14, 2014
@Whiplash5057
Copy link

Hey guys, the if statement is not present in v1.3.3. Is there a fix to this that I can use

This issue was closed.
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

3 participants