src/cm/media/js/lib/yui/yui3-3.15.0/build/anim-scroll/anim-scroll.js
changeset 602 e16a97fb364a
equal deleted inserted replaced
601:d334a616c023 602:e16a97fb364a
       
     1 YUI.add('anim-scroll', function (Y, NAME) {
       
     2 
       
     3 /**
       
     4  * Adds support for the <code>scroll</code> property in <code>to</code>
       
     5  * and <code>from</code> attributes.
       
     6  * @module anim
       
     7  * @submodule anim-scroll
       
     8  */
       
     9 
       
    10 var NUM = Number;
       
    11 
       
    12 //TODO: deprecate for scrollTop/Left properties?
       
    13 Y.Anim.behaviors.scroll = {
       
    14     set: function(anim, att, from, to, elapsed, duration, fn) {
       
    15         var
       
    16             node = anim._node,
       
    17             val = ([
       
    18             fn(elapsed, NUM(from[0]), NUM(to[0]) - NUM(from[0]), duration),
       
    19             fn(elapsed, NUM(from[1]), NUM(to[1]) - NUM(from[1]), duration)
       
    20         ]);
       
    21 
       
    22         if (val[0]) {
       
    23             node.set('scrollLeft', val[0]);
       
    24         }
       
    25 
       
    26         if (val[1]) {
       
    27             node.set('scrollTop', val[1]);
       
    28         }
       
    29     },
       
    30     get: function(anim) {
       
    31         var node = anim._node;
       
    32         return [node.get('scrollLeft'), node.get('scrollTop')];
       
    33     }
       
    34 };
       
    35 
       
    36 
       
    37 
       
    38 }, '@VERSION@', {"requires": ["anim-base"]});