index.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html lang="en" class="no-js">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Blueprint: Slide and Push Menus</title>
  8. <meta name="description" content="Blueprint: Slide and Push Menus" />
  9. <meta name="keywords" content="sliding menu, pushing menu, navigation, responsive, menu, css, jquery" />
  10. <meta name="author" content="Codrops" />
  11. <link rel="shortcut icon" href="../favicon.ico">
  12. <link rel="stylesheet" type="text/css" href="css/default.css" />
  13. <link rel="stylesheet" type="text/css" href="css/component.css" />
  14. <script src="js/modernizr.custom.js"></script>
  15. </head>
  16. <body class="cbp-spmenu-push">
  17. <nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1">
  18. <h3>Menu</h3>
  19. <a href="#">Celery seakale</a>
  20. <a href="#">Dulse daikon</a>
  21. <a href="#">Zucchini garlic</a>
  22. <a href="#">Catsear azuki bean</a>
  23. <a href="#">Dandelion bunya</a>
  24. <a href="#">Rutabaga</a>
  25. </nav>
  26. <nav class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-right" id="cbp-spmenu-s2">
  27. <h3>Menu</h3>
  28. <a href="#">Celery seakale</a>
  29. <a href="#">Dulse daikon</a>
  30. <a href="#">Zucchini garlic</a>
  31. <a href="#">Catsear azuki bean</a>
  32. <a href="#">Dandelion bunya</a>
  33. <a href="#">Rutabaga</a>
  34. </nav>
  35. <nav class="cbp-spmenu cbp-spmenu-horizontal cbp-spmenu-top" id="cbp-spmenu-s3">
  36. <h3>Menu</h3>
  37. <a href="#">Celery seakale</a>
  38. <a href="#">Dulse daikon</a>
  39. <a href="#">Zucchini garlic</a>
  40. <a href="#">Catsear azuki bean</a>
  41. <a href="#">Dandelion bunya</a>
  42. <a href="#">Rutabaga</a>
  43. <a href="#">Celery seakale</a>
  44. <a href="#">Dulse daikon</a>
  45. <a href="#">Zucchini garlic</a>
  46. <a href="#">Catsear azuki bean</a>
  47. <a href="#">Dandelion bunya</a>
  48. <a href="#">Rutabaga</a>
  49. </nav>
  50. <nav class="cbp-spmenu cbp-spmenu-horizontal cbp-spmenu-bottom" id="cbp-spmenu-s4">
  51. <h3>Menu</h3>
  52. <a href="#">Celery seakale</a>
  53. <a href="#">Dulse daikon</a>
  54. <a href="#">Zucchini garlic</a>
  55. <a href="#">Catsear azuki bean</a>
  56. <a href="#">Dandelion bunya</a>
  57. <a href="#">Rutabaga</a>
  58. <a href="#">Celery seakale</a>
  59. <a href="#">Dulse daikon</a>
  60. <a href="#">Zucchini garlic</a>
  61. <a href="#">Catsear azuki bean</a>
  62. <a href="#">Dandelion bunya</a>
  63. <a href="#">Rutabaga</a>
  64. </nav>
  65. <div class="container">
  66. <header class="clearfix">
  67. <span>Blueprint</span>
  68. <h1>Slide and Push Menus</h1>
  69. </header>
  70. <div class="main">
  71. <section>
  72. <h2>Slide Menus</h2>
  73. <!-- Class "cbp-spmenu-open" gets applied to menu -->
  74. <button id="showLeft">Show/Hide Left Slide Menu</button>
  75. <button id="showRight">Show/Hide Right Slide Menu</button>
  76. <button id="showTop">Show/Hide Top Slide Menu</button>
  77. <button id="showBottom">Show/Hide Bottom Slide Menu</button>
  78. </section>
  79. <section class="buttonset">
  80. <h2>Push Menus</h2>
  81. <!-- Class "cbp-spmenu-open" gets applied to menu and "cbp-spmenu-push-toleft" or "cbp-spmenu-push-toright" to the body -->
  82. <button id="showLeftPush">Show/Hide Left Push Menu</button>
  83. <button id="showRightPush">Show/Hide Right Push Menu</button>
  84. </section>
  85. </div>
  86. </div>
  87. <!-- Classie - class helper functions by @desandro https://github.com/desandro/classie -->
  88. <script src="js/classie.js"></script>
  89. <script>
  90. var menuLeft = document.getElementById( 'cbp-spmenu-s1' ),
  91. menuRight = document.getElementById( 'cbp-spmenu-s2' ),
  92. menuTop = document.getElementById( 'cbp-spmenu-s3' ),
  93. menuBottom = document.getElementById( 'cbp-spmenu-s4' ),
  94. showLeft = document.getElementById( 'showLeft' ),
  95. showRight = document.getElementById( 'showRight' ),
  96. showTop = document.getElementById( 'showTop' ),
  97. showBottom = document.getElementById( 'showBottom' ),
  98. showLeftPush = document.getElementById( 'showLeftPush' ),
  99. showRightPush = document.getElementById( 'showRightPush' ),
  100. body = document.body;
  101. showLeft.onclick = function() {
  102. classie.toggle( this, 'active' );
  103. classie.toggle( menuLeft, 'cbp-spmenu-open' );
  104. disableOther( 'showLeft' );
  105. };
  106. showRight.onclick = function() {
  107. classie.toggle( this, 'active' );
  108. classie.toggle( menuRight, 'cbp-spmenu-open' );
  109. disableOther( 'showRight' );
  110. };
  111. showTop.onclick = function() {
  112. classie.toggle( this, 'active' );
  113. classie.toggle( menuTop, 'cbp-spmenu-open' );
  114. disableOther( 'showTop' );
  115. };
  116. showBottom.onclick = function() {
  117. classie.toggle( this, 'active' );
  118. classie.toggle( menuBottom, 'cbp-spmenu-open' );
  119. disableOther( 'showBottom' );
  120. };
  121. showLeftPush.onclick = function() {
  122. classie.toggle( this, 'active' );
  123. classie.toggle( body, 'cbp-spmenu-push-toright' );
  124. classie.toggle( menuLeft, 'cbp-spmenu-open' );
  125. disableOther( 'showLeftPush' );
  126. };
  127. showRightPush.onclick = function() {
  128. classie.toggle( this, 'active' );
  129. classie.toggle( body, 'cbp-spmenu-push-toleft' );
  130. classie.toggle( menuRight, 'cbp-spmenu-open' );
  131. disableOther( 'showRightPush' );
  132. };
  133. function disableOther( button ) {
  134. if( button !== 'showLeft' ) {
  135. classie.toggle( showLeft, 'disabled' );
  136. }
  137. if( button !== 'showRight' ) {
  138. classie.toggle( showRight, 'disabled' );
  139. }
  140. if( button !== 'showTop' ) {
  141. classie.toggle( showTop, 'disabled' );
  142. }
  143. if( button !== 'showBottom' ) {
  144. classie.toggle( showBottom, 'disabled' );
  145. }
  146. if( button !== 'showLeftPush' ) {
  147. classie.toggle( showLeftPush, 'disabled' );
  148. }
  149. if( button !== 'showRightPush' ) {
  150. classie.toggle( showRightPush, 'disabled' );
  151. }
  152. }
  153. </script>
  154. </body>
  155. </html>