daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest May 17th, 2018 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var pCarousel = {
  2.     animationId: null,
  3.     animationDir: 'left',
  4.    
  5.     //time in miliseconds to wait before scrolling
  6.     animationTimeout: 3000,
  7.    
  8.     //time in miliseconds for the scrolling transition
  9.     animationSpeed: 900,
  10.    
  11.    
  12.     init: function(carousel) {
  13.         // Disable autoscrolling if the user clicks the prev or next button.
  14.         carousel.clip.hover(function() { pCarousel.halt() }, function() { pCarousel.animate(carousel); });
  15.         pCarousel.animate(carousel);
  16.        
  17.         jQuery('a.pCarouselNext').bind('click', function() {
  18.         pCarousel.halt();
  19.         carousel.next();
  20.         return false;
  21.     });
  22.        
  23.         jQuery('a.pCarouselPrev').bind('click', function() {
  24.         pCarousel.halt();
  25.         carousel.prev();
  26.         return false;
  27.     });
  28.        
  29.         jQuery('a.pCarouselStop').bind('click', function() {
  30.         pCarousel.halt();
  31.         return false;
  32.     });
  33.        
  34.         jQuery('a.pCarouselStart').bind('click', function() {
  35.         if( pCarousel.animationId ) { //already running
  36.             //pCarousel.halt();
  37.             carousel.scroll(1);
  38.             //pCarousel.animationDir = 'left';
  39.         }
  40.  
  41.         pCarousel.animate(carousel);
  42.         return false;
  43.     });
  44.        
  45.     },
  46.    
  47.     animate: function(carousel) {
  48.         pCarousel.animationId = setInterval( function() {
  49. carousel.next();        }, pCarousel.animationTimeout );
  50.     },
  51.    
  52.     halt: function() {
  53.         if( pCarousel.animationId ) {
  54.             clearInterval(pCarousel.animationId);
  55.         }
  56.     }
  57.    
  58. };
  59.  
  60. jQuery(document).ready(function() {
  61.     jQuery('#pCarousel').jcarousel({
  62.         wrap: 'circular',
  63.         animation: 'fast',
  64.         easing: 'swing',
  65.         scroll: 1,
  66.         visible: 4,
  67.         initCallback: pCarousel.init,
  68.         animation: pCarousel.animationSpeed,
  69.         buttonPrevHTML: null,
  70.         buttonNextHTML: null
  71.     });
  72. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top