[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/js/dynapi/fx/ -> fader.js (source)

   1  /*
   2      DynAPI Distribution
   3      Fader Animation Extension
   4  
   5      The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
   6  
   7      requires: DynLayer
   8  */
   9  
  10  Fader = {}; // used by dynapi.library
  11  
  12  p = DynLayer.prototype;
  13  
  14  p._fadeMode = '';
  15  p.fadeIn = function(inc,ms){
  16      this._opacity=0;
  17      this._fadeMode='in';
  18      this.fadeTo(100,(inc||4),ms);
  19  };
  20  p.fadeOut = function(inc,ms){
  21      this._opacity=100;
  22      this._fadeMode='out';
  23      this.fadeTo(0,inc||4,ms);
  24  };
  25  // Fades an object to "opacity" by "inc" increments in every "ms" millisenconds
  26  p.fadeTo = function(opacity,inc,ms){
  27      if(this._opacity==null) this._opacity=100;
  28      inc=(inc)? Math.abs(inc):5;
  29      this._fadeMs=(ms)? ms:50;
  30      if (this._opacity>opacity) inc*=-1;
  31      this._fadeInc=inc;
  32      this._fadeToOpacity = opacity;
  33      this._fadeTimeout=window.setTimeout(this+'._fade()',this._fadeMs);
  34  };
  35  p._fade = function(){
  36      var ua=dynapi.ua;
  37      var fm=this._fadeMode;
  38      var inc = this._fadeInc;
  39      var opac = this._opacity;
  40      var fopac = this._fadeToOpacity;
  41      opac+=inc;
  42      if ((inc<0 && opac<=fopac)|| (inc>0 && opac>=fopac)) opac=fopac;
  43      this._opacity=opac;
  44      if(!ua.def) this.setVisible((opac>0)? true:false);
  45      else if(ua.dom && this.css){
  46          if(opac>1 && this.visible==false) this.setVisible(true);
  47          if(ua.ie) this.css.filter='alpha(opacity=' + opac + ')';
  48          else this.css.MozOpacity = parseInt(opac)/100;
  49      }
  50      if(opac!=fopac) this._fadeTimeout=window.setTimeout(this+'._fade()',this._fadeMs);
  51      else {
  52          this._fadeMode='';
  53          window.clearTimeout(this._fadeTimeout);
  54          this.invokeEvent('fade'+fm);
  55      
  56      }
  57  };
  58  
  59  p.getOpacity = function(){
  60      if (this._opacity ||(this._opacity == 0)) return this._opacity;
  61      else return    this._opacity=100;
  62  };
  63  p.setOpacity = function(n){
  64      var ua=dynapi.ua;
  65      if(n>100) n=100;
  66      else if(n<0)n=0;
  67      this._opacity = n;
  68      this.fadeTo(n);
  69  };


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7