splitbox.css 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. x-splitbox {
  2. position: relative;
  3. display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
  4. display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
  5. display: -ms-flexbox; /* TWEENER - IE 10 */
  6. display: -webkit-flex; /* NEW - Chrome */
  7. display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
  8. height: 100%;
  9. overflow: hidden;
  10. -webkit-box-sizing: border-box;
  11. -moz-box-sizing: border-box;
  12. -ms-box-sizing: border-box;
  13. box-sizing: border-box;
  14. -webkit-box-orient: horizontal;
  15. -moz-box-orient: horizontal;
  16. -ms-box-orient: horizontal;
  17. box-orient: horizontal;
  18. -webkit-flex-direction: row;
  19. -moz-flex-direction: row;
  20. -ms-flex-direction: row;
  21. flex-direction: row;
  22. }
  23. x-splitbox[direction="column"] {
  24. -webkit-box-orient: vertical;
  25. -moz-box-orient: vertical;
  26. -ms-box-orient: vertical;
  27. box-orient: vertical;
  28. -webkit-flex-direction: column;
  29. -moz-flex-direction: column;
  30. -ms-flex-direction: column;
  31. flex-direction: column;
  32. }
  33. x-splitbox > *:not([splitter]) {
  34. min-width: 0;
  35. min-height: 0;
  36. -webkit-box-flex: 1;
  37. -moz-box-flex: 1;
  38. -webkit-flex: 1;
  39. flex: 1;
  40. -ms-flex: auto;
  41. -webkit-box-sizing: border-box;
  42. -moz-box-sizing: border-box;
  43. -ms-box-sizing: border-box;
  44. box-sizing: border-box;
  45. }
  46. x-splitbox[dragging], x-splitbox > [splitter] {
  47. -moz-user-select: -moz-none;
  48. -khtml-user-select: none;
  49. -webkit-user-select: none;
  50. -ms-user-select: none;
  51. user-select: none;
  52. -webkit-user-drag: none;
  53. }
  54. x-splitbox > [splitter] {
  55. display: block;
  56. position: relative;
  57. min-width: 0px !important;
  58. max-width: 0px !important;
  59. cursor: ew-resize;
  60. background: #fff;
  61. opacity: 0.6;
  62. }
  63. x-splitbox > [splitter]:before {
  64. content: " ";
  65. display: block;
  66. position: absolute;
  67. width: 0.8em;
  68. height: 100%;
  69. opacity: 0;
  70. background: inherit;
  71. -webkit-box-sizing: border-box;
  72. -moz-box-sizing: border-box;
  73. -ms-box-sizing: border-box;
  74. box-sizing: border-box;
  75. -webkit-transform: translate(-50%, 0);
  76. -ms-transform: translate(-50%, 0);
  77. transform: translate(-50%, 0);
  78. }
  79. x-splitbox > [splitter]:after {
  80. content: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMWVtIiB3aWR0aD0iMWVtIiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0Ij48cGF0aCBmaWxsPSJyZ2JhKDAsMCwwLDAuNzUpIiBkPSJNNzU4IDIzNGwyMzIgMjc4LTIzMiAyNzgtNjYtNTQgMTg2LTIyNC0xODYtMjI0ek00NzAgNTU0di04NGg4NHY4NGgtODR6TTcyNiA0NzB2ODRoLTg2di04NGg4NnpNMjk4IDU1NHYtODRoODZ2ODRoLTg2ek0zMzIgMjg4bC0xODYgMjI0IDE4NiAyMjQtNjYgNTQtMjMyLTI3OCAyMzItMjc4eiI+PC9wYXRoPjwvc3ZnPg==');
  81. position: absolute;
  82. top: 50%;
  83. left: 50%;
  84. height: 1em;
  85. padding: 0.05em;
  86. background: inherit;
  87. border-radius: 100%;
  88. -webkit-box-shadow: 0 1px 1px 0px rgba(0,0,0,0.4);
  89. -ms-box-shadow: 0 1px 1px 0px rgba(0,0,0,0.4);
  90. box-shadow: 0 1px 1px 0px rgba(0,0,0,0.4);
  91. -webkit-transform: translate(-50%, -50%);
  92. -ms-transform: translate(-50%, -50%);
  93. transform: translate(-50%, -50%);
  94. }
  95. x-splitbox[direction="column"] > [splitter] {
  96. cursor: ns-resize;
  97. min-width: auto !important;
  98. max-width: none !important;
  99. min-height: 0px !important;
  100. max-height: 0px !important;
  101. }
  102. x-splitbox[direction="column"] > [splitter]:before {
  103. width: 100%;
  104. height: 0.8em;
  105. -webkit-transform: translate(0%, -50%);
  106. -ms-transform: translate(0%, -50%);
  107. transform: translate(0%, -50%);
  108. }
  109. x-splitbox[direction="column"] > [splitter]:after {
  110. -webkit-box-shadow: 1px 0 1px 0px rgba(0,0,0,0.4);
  111. -ms-box-shadow: 1px 0 1px 0px rgba(0,0,0,0.4);
  112. box-shadow: 1px 0 1px 0px rgba(0,0,0,0.4);
  113. -webkit-transform: translate(-50%, -50%) rotate(90deg);
  114. -ms-transform: translate(-50%, -50%) rotate(90deg);
  115. transform: translate(-50%, -50%) rotate(90deg);
  116. }
  117. x-splitbox > [splitter]:hover, x-splitbox > [splitter][dragging] {
  118. opacity: 1;
  119. z-index: 2;
  120. }
  121. x-splitbox > [splitter][dragging]:before {
  122. opacity: 0.3;
  123. }
  124. @media screen and (max-device-width: 415px) {
  125. x-splitbox > [splitter]:before {
  126. display: block;
  127. }
  128. x-splitbox[direction="column"] > [splitter] {
  129. display: block;
  130. }
  131. }