I am encountering a JavaScript exception related to image size.
I am trying to set a fixed size for the images in my carousel, allowing them to auto adjust or resize without concern for distortion or pixelation. I have experimented with max-width and width properties but have not been successful. Additionally, I need the carousel to be responsive.
Below is my HTML code:
<div id="myCarousel" style="display: block;" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators" id="carouselIndicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1" class=""></li>
</ol>
<div class="carousel-inner" id="carouselData" role="listbox">
<div class="item active">
<h3>Random text 1</h3>
<p>Random text 2</p>
<img src="imageurl.png" alt="">
</div>
<div class="item">
<h3>Random text 3</h3>
<p>Random text 4</p>
<img class="tales" src="imagelink.png" alt="">
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
The javascript error message states (The slider isn't functioning):
Uncaught TypeError: Cannot read property 'offsetWidth' of undefined