2013-06-03 1 views
-1

J'ai ce script et je veux ajouter un mod de jeu automatique. Voici le début:Comment faire pour que mon carrousel à roue hydraulique joue automatiquement?

$(document).ready(function() { 
    var carousel = $("#carousel").waterwheelCarousel({ 
     flankingItems: 3, 
     movingToCenter: function ($item) { 
     $('#callback-output').prepend('movingToCenter: ' + $item.attr('id') + '<br/>'); 
     }, 
     movedToCenter: function ($item) { 
     $('#callback-output').prepend('movedToCenter: ' + $item.attr('id') + '<br/>'); 
     }, 
     movingFromCenter: function ($item) { 
     $('#callback-output').prepend('movingFromCenter: ' + $item.attr('id') + '<br/>'); 
     }, 
     movedFromCenter: function ($item) { 
     $('#callback-output').prepend('movedFromCenter: ' + $item.attr('id') + '<br/>'); 
     }, 
     clickedCenter: function ($item) { 
     $('#callback-output').prepend('clickedCenter: ' + $item.attr('id') + '<br/>'); 
     } 
    }); 

Voici les boutons de navigation:

$('#prev').bind('click', function() { 
     carousel.prev(); 
     return false 
    }); 

    $('#next').bind('click', function() { 
     carousel.next(); 
     return false; 
    }); 

    $('#reload').bind('click', function() { 
     newOptions = eval("(" + $('#newoptions').val() + ")"); 
     carousel.reload(newOptions); 
     return false; 
    }); 

    }); 

Quelqu'un peut-il me s'il vous plaît aider à le faire?

Et voici mon css code:

body { 
    font-family:Arial; 
    font-size:12px; 
    background:#ededed; 
} 
.example-desc { 
    margin:3px 0; 
    padding:5px; 
} 

#carousel { 
    width:960px; 

    height:300px; 
    position:relative; 
    clear:both; 
    overflow:hidden; 
} 

Cacher les images jusqu'à carrousel peuvent les manipuler, sinon il est pas aussi des éléments évidents peuvent être cliqués:

#carousel img { 
    visibility:hidden; 
    cursor:pointer; 
} 

.split-left { 
    width:450px; 
    float:left; 
} 
.split-right { 
    width:400px; 
    float:left; 
    margin-left:10px; 
} 
#callback-output { 
    height:250px; 
    overflow:scroll; 
} 
textarea#newoptions { 
    width:430px; 
} 
+3

http://stackoverflow.com/questions/10142662/add-autoplay-to-this-jquery-carousel – karthikr

Répondre

0

Lire the documentation.

Ajoutez autoPlay: 5000, (où 5000 correspond au nombre de millisecondes entre les modifications) pour les options.

Questions connexes