1.  
  2. var MySplitPane = function() {
  3. return {
  4. getHorizSplitPane : function(sBGElId, sHandleEId, iLeft, iRight, leftContainer, rightContainer) {
  5. var slider = YAHOO.widget.Slider.getHorizSlider(sBGElId, sHandleEId, iLeft, iRight);
  6. var leftContainer = document.getElementById(leftContainer);
  7. var rightContainer = document.getElementById(rightContainer);
  8. var oriLeftWidth = parseInt(YAHOO.util.Dom.getStyle(leftContainer, "width"));
  9. var oriRightWidth = parseInt(YAHOO.util.Dom.getStyle(rightContainer, "width"));
  10.  
  11. var handleChange = function(x) {
  12. var x = this.getXValue();
  13. var leftWidth = oriLeftWidth + x;
  14. YAHOO.util.Dom.setStyle(leftContainer, "width", leftWidth + "px");
  15. var rightWidth = oriRightWidth + (x * -1);
  16. YAHOO.util.Dom.setStyle(rightContainer, "width", rightWidth + "px");
  17. }
  18. slider.subscribe("change", handleChange);
  19. return slider;
  20. },
  21. getVertSplitPane : function(sBGElId, sHandleEId, iUp, iDown, topContainer, bottomContainer) {
  22. var slider = YAHOO.widget.Slider.getVertSlider(sBGElId, sHandleEId, iUp, iDown);
  23. var topContainer = document.getElementById(topContainer);
  24. var bottomContainer = document.getElementById(bottomContainer);
  25. var oriTopHeight = parseInt(YAHOO.util.Dom.getStyle(topContainer, "height"));
  26. var oriBottomHeight = parseInt(YAHOO.util.Dom.getStyle(bottomContainer, "height"));
  27. var handleChange = function(offsetFromStart) {
  28. var y = this.getYValue();
  29. var topHeight = oriTopHeight + y;
  30.  
  31. YAHOO.util.Dom.setStyle(topContainer, "height", topHeight + "px");
  32. var bottomHeight = oriBottomHeight + (y * -1);
  33.  
  34. YAHOO.util.Dom.setStyle(bottomContainer, "height", bottomHeight + "px");
  35. }
  36. slider.subscribe("change", handleChange);
  37. return slider;
  38. }
  39. }
  40. }();
  41.  
  42.