Alexander Solonik
Alexander Solonik

Reputation: 10230

Can't get jQuery cycle plugin to work Why?

I have loaded both the cycle2 and the cycle2 carousel plugin and i am trying to get the following simple demo to work:

HTML:

<div class="slideshow" 
            class="slideshow" 
            data-cycle-fx=carousel
            data-cycle-timeout=1000 >

        <img src="img/gallery/g1.jpg" alt="featured development project">
        <img src="img/gallery/g2.jpg" alt="featured development project">
        <img src="img/gallery/g3.jpg" alt="featured development project">
        <img src="img/gallery/g1.jpg" alt="featured development project">

</div>  

<a href="#" id="g-next">next</a>
<br><br><a href="#" id="g-prev">prev</a>

I have the following scripts loaded:

    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="jquery.cycle2.js"></script>
    <script src="jquery.cycle2.carousel.js"></script>

But my demo would still now work , WHY ? i have followed exactly whats on the demo page HERE , but still can't get the cycle plugin to work.

FIDDLE HERE

Upvotes: 0

Views: 47

Answers (1)

Maffelu
Maffelu

Reputation: 2068

You have to initialize the plugin. I've updated your fiddle with the init and it looks like this: https://jsfiddle.net/maffelu/efq5fw2s/1/

At the end of the javascript code you'll see the initialization:

$(document).ready(function(){
    $(".slideshow").cycle();
});

Upvotes: 1

Related Questions