5
I’m developing a portal, with Bootstrap (3.1).
For this I put a similar bootstrap Carousel on HEADER
of the page and the content just below that Carousel. This is where the problem occurs, when loading the page, as the images have a certain weight - 200kb approx. content below the "up" page until the image is loaded.
My question is: how to make the bootstrap Carousel have a load to wait for the image to be loaded, without the page being "dancing"?
Obs.: The image varies in height, therefore, I can not place one height
or min-height
in the Carousel div, to delimit its initial size.
As for the code is exactly like the Bootstrap with an "H2" and a "p" below. As below:
<div class="carousel-inner">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<h2>Título da Página</h2>
<p>Texto texto texto</p>
200k!?!? You can’t optimize this (jpg 60-80%)?
– utluiz
You could paste some snippets of code, can help when answering.
– Onilton Maciel
200k at 60%, are images of 2000x600px, so the size "absurd".
– Nankym
@Oniltonmaciel, follows code in question.
– Nankym
Unused
min-height
? It’s like asking, "I’m thirsty... what am I doing? But I can’t take fluids or receive serum because I’m allergic to fluids and injections." - impossible mission type. I think you can and should usemin-height
. Enjoy and also use the classimg-responsive
on your tagimg
.– J. Bruni
You can, on the server-side, using a library that handles images, get the exact height of the first image to be loaded. Then apply that height on
min-height
.– J. Bruni
@J.Bruni That’s why it gets complicated, because the image is always responsive! If you could min-height was already in html. I will check what was passed on to get the height of the image and pass on the feedback.
– Nankym