API Docs for: 3.17.2
Show:

File: anim/js/anim-scroll.js

  1. /**
  2. * Adds support for the <code>scroll</code> property in <code>to</code>
  3. * and <code>from</code> attributes.
  4. * @module anim
  5. * @submodule anim-scroll
  6. */
  7.  
  8. var NUM = Number;
  9.  
  10. //TODO: deprecate for scrollTop/Left properties?
  11. Y.Anim.behaviors.scroll = {
  12. set: function(anim, att, from, to, elapsed, duration, fn) {
  13. var
  14. node = anim._node,
  15. val = ([
  16. fn(elapsed, NUM(from[0]), NUM(to[0]) - NUM(from[0]), duration),
  17. fn(elapsed, NUM(from[1]), NUM(to[1]) - NUM(from[1]), duration)
  18. ]);
  19.  
  20. if (val[0]) {
  21. node.set('scrollLeft', val[0]);
  22. }
  23.  
  24. if (val[1]) {
  25. node.set('scrollTop', val[1]);
  26. }
  27. },
  28. get: function(anim) {
  29. var node = anim._node;
  30. return [node.get('scrollLeft'), node.get('scrollTop')];
  31. }
  32. };
  33.  
  34.