// Options : https://github.com/ProLoser/AnythingSlider/wiki/Usage
// Cliquer sur les liens Appearance, Navigation, Slideshow, etc.. pour voir toutes les options possibles

$(document).ready(function(){
 $('#slider')
  .anythingSlider({
   width        : 782,
   height       : 223,
   startStopped : false,    // Démarrage auto
   startPanel   : 1,        // On commence à 1
   infiniteSlides : true,   // On boucle indéfiniment
   buildArrows : true,      // Flèches précédent/suivant
   buildNavigation : true,  // Numéros de navigation
   enableNavigation : true, // Navigation cliquable (et pas juste déco)
   pauseOnHover : true,     // Pause en mouseover
   delay : 5000,            // Pause toutes les X millisecondes
   animationTime : 600,      // Le temps que ça prend pour passer d'un slide à l'autre
   autoPlay : true
  })
  /* this "custom" code is the equivalent of the base caption functions */
  .anythingSliderFx({
       inFx: {
        '.caption-top'    : { top: 0, opacity: 0.8, time: 400 },
        '.caption-right'  : { right: 0, opacity: 0.8, time: 400 },
        '.caption-bottom' : { bottom: 0, opacity: 0.8, time: 400 },
        '.caption-left'   : { left: 0, opacity: 0.8, time: 400 }
       },
       outFx: {
        '.caption-top'    : { top: -50, opacity: 0, time: 350 },
        '.caption-right'  : { right: -150, opacity: 0, time: 350 },
        '.caption-bottom' : { bottom: -50, opacity: 0, time: 350 },
        '.caption-left'   : { left: -150, opacity: 0, time: 350 }
       }
  })
  /* add a close button (x) to the caption */
  .find('div[class*=caption]')
    .css({ position: 'absolute' })
    //.prepend('<span class="close">x</span>')
    .find('.close').click(function(){
     var cap = $(this).parent(),
      ani = { bottom : -50 }; // bottom
      if (cap.is('.caption-top')) { ani = { top: -50 }; }
      if (cap.is('.caption-left')) { ani = { left: -150 }; }
      if (cap.is('.caption-right')) { ani = { right: -150 }; }
      cap.animate(ani, 400, function(){ cap.hide(); } );
    });
});
