Slide.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dojox.widget.rotator.Slide"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.widget.rotator.Slide"] = true;
  8. dojo.provide("dojox.widget.rotator.Slide");
  9. (function(d){
  10. // Constants used to identify which edge the pane slides in from.
  11. var DOWN = 0,
  12. RIGHT = 1,
  13. UP = 2,
  14. LEFT = 3;
  15. function _slide(/*int*/type, /*Object*/args){
  16. // summary:
  17. // Handles the preparation of the dom node and creates the dojo.Animation object.
  18. var node = args.node = args.next.node,
  19. r = args.rotatorBox,
  20. m = type % 2,
  21. s = (m ? r.w : r.h) * (type < 2 ? -1 : 1);
  22. d.style(node, {
  23. display: "",
  24. zIndex: (d.style(args.current.node, "zIndex") || 1) + 1
  25. });
  26. if(!args.properties){
  27. args.properties = {};
  28. }
  29. args.properties[m ? "left" : "top"] = {
  30. start: s,
  31. end: 0
  32. };
  33. return d.animateProperty(args); /*dojo.Animation*/
  34. }
  35. d.mixin(dojox.widget.rotator, {
  36. slideDown: function(/*Object*/args){
  37. // summary:
  38. // Returns a dojo.Animation that slides in the next rotator pane from the top.
  39. return _slide(DOWN, args); /*dojo.Animation*/
  40. },
  41. slideRight: function(/*Object*/args){
  42. // summary:
  43. // Returns a dojo.Animation that slides in the next rotator pane from the right.
  44. return _slide(RIGHT, args); /*dojo.Animation*/
  45. },
  46. slideUp: function(/*Object*/args){
  47. // summary:
  48. // Returns a dojo.Animation that slides in the next rotator pane from the bottom.
  49. return _slide(UP, args); /*dojo.Animation*/
  50. },
  51. slideLeft: function(/*Object*/args){
  52. // summary:
  53. // Returns a dojo.Animation that slides in the next rotator pane from the left.
  54. return _slide(LEFT, args); /*dojo.Animation*/
  55. }
  56. });
  57. })(dojo);
  58. }