findawayer / kineto

Smart and versatile JavaScript carousel plugin.
https://findawayer.github.io/kineto/
MIT License
10 stars 0 forks source link

Kineto requires resize to work properly in flexbox #3

Closed PrzemyslawKlys closed 3 years ago

PrzemyslawKlys commented 3 years ago

What would be the best way to wrap Kineto into a flexbox? I would like to be able to add multiple carousels around different parts of HTML and would like it to automatically resize within flexbox.

PrzemyslawKlys commented 3 years ago

To give you an idea of what I am after:

  1. https://codepen.io/MadBoyEvo/pen/LYxqVrz - in this one I add a chart into kineto 3rd slide and it doesn't resize properly, but if you press F12 on the 3rd slide - chart shows up. It also acts weird when I add 4 texts to slide 2, I would expect them to be under each other.
  2. https://codepen.io/MadBoyEvo/pen/gOgqwVX - where I would like to add multiple carousels next to each other in flexbox.

Any ideas on how to get it done?

PrzemyslawKlys commented 3 years ago

Ok, so it seems when I modified it a bit with proper flexbox inside slide it does work how I want it, but only after I resize the screen. Here's the code pen: https://codepen.io/MadBoyEvo/pen/gOgqWxK

Initially Kineto is not working correctly, but if I force resize by pressing F12 it works.

ErrorKineto

PrzemyslawKlys commented 3 years ago

After moving to the bottom - it works :-) Sorry for bugging

<script>
     Kineto.create("#Carousel-kNUqkOdG", { height: "auto" });
</script>
findawayer commented 3 years ago

@PrzemyslawKlys You can also make Kineto recalculate the layout by calling Kineto.reload() method on page load, too. Same as what could happen inside an initially invisible modal. ref: https://findawayer.github.io/kineto/#FAQ