JAVASCRIPT   62
slideshow flash
Guest on 21st May 2022 02:03:40 AM


  1. /**
  2. Script: Slideshow.Flash.js
  3.         Slideshow.Flash - Flash extension for Slideshow.
  4.  
  5. License:
  6.         MIT-style license.
  7.  
  8. Copyright:
  9.         Copyright (c) Aeron Glemann
  10.  
  11. Dependencies:
  12.         Slideshow.
  13. */
  14.  
  15. (function(){
  16.         Slideshow.Flash = new Class({
  17.                 Extends: Slideshow,
  18.        
  19.                 options: {
  20.                         color: ['#FFF']
  21.                 },
  22.        
  23.         /**
  24.         Constructor: initialize
  25.                 Creates an instance of the Slideshow class.
  26.  
  27.         Arguments:
  28.                 element - (element) The wrapper element.
  29.                 data - (array or object) The images and optional thumbnails, captions and links for the show.
  30.                 options - (object) The options below.
  31.  
  32.         Syntax:
  33.                 var myShow = new Slideshow.Flash(element, data, options);
  34. */
  35.  
  36.                 initialize: function(el, data, options){
  37.                         options = options || {};
  38.                         options.overlap = true;
  39.                         if (options.color)
  40.                                 options.color = Array.from(options.color);
  41.                         this.parent(el, data, options);
  42.                 },
  43.  
  44.         /**
  45.         Private method: show
  46.                 Does the slideshow effect.
  47. */
  48.  
  49.                 _show: function(fast){
  50.                         if (!this.image.retrieve('tween'))
  51.                           $$(this.a, this.b).set('tween', {'duration': this.options.duration, 'link': 'cancel', 'onStart': this._start.bind(this), 'onComplete': this._complete.bind(this), 'property': 'opacity'});
  52.                         if (fast)
  53.                                 this.image.get('tween').cancel().set(1);
  54.                         else {
  55.                                 this.el.retrieve('images').setStyle('background', this.options.color[this.slide % this.options.color.length]);
  56.                                 var img = (this.counter % 2) ? this.a : this.b;
  57.                                 img.get('tween').cancel().set(0);
  58.                                 this.image.get('tween').set(0).start(1);
  59.                         }
  60.                 }
  61.         });
  62. })();

Raw Paste

Login or Register to edit or fork this paste. It's free.