My bootstrap carousel is not working for some reason. I have rechecked my code again and again but I still couldn't figure out what's wrong with my code. Any help would be appreciated.
These are my API Calls in my HTML:
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<script src="js/bootstrap.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.carousel').carousel()
});
</script>
This is the actual code for the Bootstrap Carousel:
<div id="myCarousel" class="carousel slide"><!-- .carousel -->
<div class="carousel-inner">
<div class="active-item"><img src="images/Qatar.jpg" alt="" width="1200" style="border-radius:10px;" alt="Slide 1"/></div>
<div class="item"><img src="images/QC.jpg" alt="" width="1200" style="border-radius:10px;" alt="Slide 1"/></div>
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div><!-- .carousel -->
wrong order include jquery before bootstrap
Try this fiddle: http://jsfiddle.net/RazGP/3/
A few clean up items:
alt
attributesslide 1
toslide 2
(for slide 2, of course)active-item
toactive item
HTML
@Sean I already found the error in the chrome console. The errors are:Failed to load resource: net::ERR_FILE_NOT_FOUND, Uncaught TypeError: undefined is not a function, Uncaught ReferenceError: $ is not defined
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
this will inherit the hostname which is file\, so you are not able to findfile://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
,try
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
insteadI guess you are open the browser from your local disk instead of from a web server :)
Thank you for your suggestions. However, as it turns out, my carousel was not working because I had a tag like this:
when it should have been like this:
I thank you still for your kind suggestions!