質問

So I have a website that is done in PHP. I have to include a simple slider in the website with this code.

http://jsfiddle.net/Wb3se/

$('#slides').cycle({ 
    fx: 'scrollLeft'
});

Very very simple code. Im getting that error which from what I understand usually means that the browser does not understand what 'cycle' mean. I am using jquery 1.10. So no idea why it would do that. Here is how it is setup.

Header.php has a link to jQuery on googles server, and has a link to a hard copy of cycle.js on the server.

The body has the html in it, css file has css in it

footer has the java.js file with the javascript in it followed by </body> tag.

役に立ちましたか?

解決

It sounds like the cycle plugin isn't loaded when you're initializing the slideshow. Check the NET tab in firebug or the resources tab in Chrome developer tools. Make sure the link to cycle is before your slideshow code. Also, make sure the DOM is ready when you initialize cycle:

$(function() {
    $('#slides').cycle({ 
        fx: 'scrollLeft'
    });
});

or

$(document).ready(function() {
    $('#slides').cycle({ 
        fx: 'scrollLeft'
    });
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top