Slide.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // wrapped by build app
  2. define("dojox/widget/rotator/Slide", ["dijit","dojo","dojox"], function(dijit,dojo,dojox){
  3. dojo.provide("dojox.widget.rotator.Slide");
  4. (function(d){
  5. // Constants used to identify which edge the pane slides in from.
  6. var DOWN = 0,
  7. RIGHT = 1,
  8. UP = 2,
  9. LEFT = 3;
  10. function _slide(/*int*/type, /*Object*/args){
  11. // summary:
  12. // Handles the preparation of the dom node and creates the dojo.Animation object.
  13. var node = args.node = args.next.node,
  14. r = args.rotatorBox,
  15. m = type % 2,
  16. s = (m ? r.w : r.h) * (type < 2 ? -1 : 1);
  17. d.style(node, {
  18. display: "",
  19. zIndex: (d.style(args.current.node, "zIndex") || 1) + 1
  20. });
  21. if(!args.properties){
  22. args.properties = {};
  23. }
  24. args.properties[m ? "left" : "top"] = {
  25. start: s,
  26. end: 0
  27. };
  28. return d.animateProperty(args); /*dojo.Animation*/
  29. }
  30. d.mixin(dojox.widget.rotator, {
  31. slideDown: function(/*Object*/args){
  32. // summary:
  33. // Returns a dojo.Animation that slides in the next rotator pane from the top.
  34. return _slide(DOWN, args); /*dojo.Animation*/
  35. },
  36. slideRight: function(/*Object*/args){
  37. // summary:
  38. // Returns a dojo.Animation that slides in the next rotator pane from the right.
  39. return _slide(RIGHT, args); /*dojo.Animation*/
  40. },
  41. slideUp: function(/*Object*/args){
  42. // summary:
  43. // Returns a dojo.Animation that slides in the next rotator pane from the bottom.
  44. return _slide(UP, args); /*dojo.Animation*/
  45. },
  46. slideLeft: function(/*Object*/args){
  47. // summary:
  48. // Returns a dojo.Animation that slides in the next rotator pane from the left.
  49. return _slide(LEFT, args); /*dojo.Animation*/
  50. }
  51. });
  52. })(dojo);
  53. });