EloiseM
EloiseM

Reputation: 39

bxSlider is not working properly

For some reason, I can't make my jQuery work. I've followed every step and nothing! Here's what's happening:

All the styles and JavaScript:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js">   <\/script>')</script>
<script src="http://bxslider.com/lib/jquery.bxslider.js"></script>
<link href="http://bxslider.com/lib/jquery.bxslider.css" rel="stylesheet" type="text/css" />

And my HTML:

<ul id="bxslider">
<li><img src="1.jpg" /></li>
<li><img src="2.jpg" /></li>
<li><img src="3.jpg" /></li>
</ul>

<script type="text/javascript">
$(document).ready(function() {
    $('.bxslider').bxSlider({
        auto: true,
        autoControls: true
    });
});
</script>

Upvotes: 2

Views: 8442

Answers (2)

Srikanth AD
Srikanth AD

Reputation: 1854

Also, you would want to load CSS first and then, the JavaScript files.

Upvotes: 1

Irvin Dominin
Irvin Dominin

Reputation: 30993

You are initiating the slider using bxslider as class, but in your case you have to use as id selector like:

$(document).ready(function () {
    $('#bxslider').bxSlider({
        auto: true,
        autoControls: true
    });
});

Selectors docs: http://api.jquery.com/category/selectors/

Working fiddle: http://jsfiddle.net/IrvinDominin/UV4r4/1/

Upvotes: 4

Related Questions