Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var pCarousel = {
- animationId: null,
- animationDir: 'left',
- //time in miliseconds to wait before scrolling
- animationTimeout: 3000,
- //time in miliseconds for the scrolling transition
- animationSpeed: 900,
- init: function(carousel) {
- // Disable autoscrolling if the user clicks the prev or next button.
- carousel.clip.hover(function() { pCarousel.halt() }, function() { pCarousel.animate(carousel); });
- pCarousel.animate(carousel);
- jQuery('a.pCarouselNext').bind('click', function() {
- pCarousel.halt();
- carousel.next();
- return false;
- });
- jQuery('a.pCarouselPrev').bind('click', function() {
- pCarousel.halt();
- carousel.prev();
- return false;
- });
- jQuery('a.pCarouselStop').bind('click', function() {
- pCarousel.halt();
- return false;
- });
- jQuery('a.pCarouselStart').bind('click', function() {
- if( pCarousel.animationId ) { //already running
- //pCarousel.halt();
- carousel.scroll(1);
- //pCarousel.animationDir = 'left';
- }
- pCarousel.animate(carousel);
- return false;
- });
- },
- animate: function(carousel) {
- pCarousel.animationId = setInterval( function() {
- carousel.next(); }, pCarousel.animationTimeout );
- },
- halt: function() {
- if( pCarousel.animationId ) {
- clearInterval(pCarousel.animationId);
- }
- }
- };
- jQuery(document).ready(function() {
- jQuery('#pCarousel').jcarousel({
- wrap: 'circular',
- animation: 'fast',
- easing: 'swing',
- scroll: 1,
- visible: 4,
- initCallback: pCarousel.init,
- animation: pCarousel.animationSpeed,
- buttonPrevHTML: null,
- buttonNextHTML: null
- });
- });
Add Comment
Please, Sign In to add comment