Corey
Corey

Reputation: 21

My jquery slider is not working properly

I'm pretty new with JQuery, I'm trying to get this script to work. I'm trying to create a rotator on the homepage of a clients website but I can't get it to run! I get no errors, the files are were they're supposed to be, I can't for the life of me figure out what the problem is!

Here's a snipped of the code:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="jquery.bxSlider.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
    $("form#newsletter-form").submit(function () {
        $.post("/newsletter.ajax.php", {
            action: 'subscribe',
            email: $("form#newsletter-form input#email").val()
        }, function (json) {
            if (json.success == true) {
                $("div.form-container").empty().append("<p>Thank you for submitting your info.</p>");
            } else {
                alert(json.error);
            }
        }, 'json');
        return false;

        $(function () {
            $('#show-options').click(function () {
                $('#options').slideToggle();
                $(this).toggleClass('open');
                return false;
            });
        });

        $('#slider1').bxSlider({
            infiniteLoop: false,
            auto: true,
            pager: true
        });
    });
});
</script>

The slider is what I'm trying to get to run, I wonder if the problem has to do with the function above it or if there's a conflict.

Thank You.

Upvotes: 2

Views: 8366

Answers (3)

Jonathan Kempf
Jonathan Kempf

Reputation: 697

I had this same problem, but resolved the issue by using jQuery.noConflict:

    var j = jQuery.noConflict();
    j(document).ready(function () {
       j('#slider1').bxSlider();
});

Upvotes: 6

Rahul Thakur
Rahul Thakur

Reputation: 821

I had the same problem... i was editing the worpress default "twenty ten" theme when i had this problem "bxSlider is not a function". I checked that it loaded properly and everything but couldn't figure it out later i uninstalled a plugin called "TubePress" and the slider started working somehow. I tried it again by installing that pluggin and running bxslider again and i got the same error. So i am pretty sure that it was due to conflict with some of the scripts that were loaded by that plugin which created that problem.

So my suggestion is that you can just go on uncommenting scripts to find out which script is conflicting wth bxslider.

Sorry this is not a very convincing solution but that is what i have right now though i'll update my answer if i find out what exactly is causing this problem.

Upvotes: 1

Sarfraz
Sarfraz

Reputation: 382861

It is most likely because the src to your slider script is not correct:

<script src="jquery.bxSlider.min.js" type="text/javascript"></script>

======================^ It isn't valid path

Upvotes: 0

Related Questions