basic.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width" />
  6. <title>basic1</title>
  7. <link rel="stylesheet" href="../css/flickity.css" />
  8. <link rel="stylesheet" href="sandbox.css" />
  9. <style>
  10. #gallery3,
  11. #gallery3 .cell,
  12. #gallery3 input,
  13. #gallery3 button {
  14. font-size: 20px;
  15. }
  16. #gallery3 .cell {
  17. padding-top: 20px;
  18. padding-left: 100px;
  19. }
  20. #gallery3 p { margin: 0 0 10px; }
  21. /*#gallery6 .cell { margin: 0 40px; }*/
  22. @media screen and ( min-width: 900px ) {
  23. #gallery5 {
  24. background: #DDF;
  25. }
  26. #gallery5:after {
  27. content: 'flickity';
  28. display: none;
  29. }
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <h1>basic1</h1>
  35. <div id="full-width" class="container">
  36. <div class="cell" n1></div>
  37. <div class="cell" n2></div>
  38. <div class="cell" n3></div>
  39. <div class="cell" n4></div>
  40. <div class="cell" n5></div>
  41. <div class="cell" n6></div>
  42. <div class="cell" n7></div>
  43. </div>
  44. <div id="half-width" class="container">
  45. <div class="cell"></div>
  46. <div class="cell"></div>
  47. <div class="cell"></div>
  48. <div class="cell"></div>
  49. <div class="cell"></div>
  50. <div class="cell"></div>
  51. <div class="cell"></div>
  52. <div class="cell"></div>
  53. <div class="cell"></div>
  54. <div class="cell"></div>
  55. </div>
  56. <div id="gallery3" class="container">
  57. <div class="cell">
  58. <select>
  59. <option>Michaelangelo</option>
  60. <option>Donatello</option>
  61. <option>Leonardo</option>
  62. <option>Raphael</option>
  63. </select>
  64. </div>
  65. <div class="cell">
  66. <p><button>Button</button> <a href="http://example.com">go to example.com</a></p>
  67. <p><input /></p>
  68. <p>
  69. <input type="checkbox" />
  70. <input type="radio" name="foo" />
  71. <input type="radio" name="foo" />
  72. <input type="range" />
  73. </p>
  74. </div>
  75. <div class="cell"></div>
  76. <div class="cell"></div>
  77. <div class="cell"></div>
  78. <div class="cell"></div>
  79. <div class="cell"></div>
  80. <div class="cell"></div>
  81. <div class="cell"></div>
  82. <div class="cell"></div>
  83. <div class="cell"></div>
  84. </div>
  85. <div id="gallery4" class="container js-flickity">
  86. <div class="cell"></div>
  87. <div class="cell"></div>
  88. <div class="cell"></div>
  89. <div class="cell"></div>
  90. <div class="cell"></div>
  91. <div class="cell"></div>
  92. <div class="cell"></div>
  93. </div>
  94. <h2>contain</h2>
  95. <div id="gallery6" class="container variable-width js-flickity"
  96. data-flickity-options='{ "contain": true }'>
  97. <div class="cell n1">1</div>
  98. <div class="cell n2 w2">2</div>
  99. <div class="cell n3 w3">3</div>
  100. <div class="cell n4">4</div>
  101. <div class="cell n5 w2">5</div>
  102. <div class="cell n6">6</div>
  103. </div>
  104. <h2>contain, freeScroll</h2>
  105. <div id="gallery6" class="container variable-width js-flickity"
  106. data-flickity-options='{ "contain": true, "freeScroll": true }'>
  107. <div class="cell n1">1</div>
  108. <div class="cell n2 w2">2</div>
  109. <div class="cell n3 w3">3</div>
  110. <div class="cell n4">4</div>
  111. <div class="cell n5 w2">5</div>
  112. <div class="cell n6">6</div>
  113. <div class="cell n1">7</div>
  114. <div class="cell n2 w2">8</div>
  115. <div class="cell n3 w3">9</div>
  116. </div>
  117. <h2>contain, few</h2>
  118. <div class="container variable-width js-flickity"
  119. data-flickity-options='{ "contain": true, "cellAlign": "center" }'>
  120. <div class="cell n1">1</div>
  121. <div class="cell n2">2</div>
  122. <!-- <div class="cell n3">3</div> -->
  123. </div>
  124. <h2>watch, activate >900px</h2>
  125. <div id="gallery5" class="container variable-width js-flickity"
  126. data-flickity-options='{ "wrapAround": true, "watchCSS": true }'>
  127. <div class="cell n1 w3"></div>
  128. <div class="cell n2 w2"></div>
  129. <div class="cell n3"></div>
  130. <div class="cell n4 w3"></div>
  131. <div class="cell n5"></div>
  132. <div class="cell n6 w2"></div>
  133. <div class="cell n4"></div>
  134. <div class="cell n2"></div>
  135. </div>
  136. <script src="../bower_components/get-size/get-size.js"></script>
  137. <script src="../bower_components/desandro-matches-selector/matches-selector.js"></script>
  138. <script src="../bower_components/ev-emitter/ev-emitter.js"></script>
  139. <script src="../bower_components/unipointer/unipointer.js"></script>
  140. <script src="../bower_components/unidragger/unidragger.js"></script>
  141. <script src="../bower_components/fizzy-ui-utils/utils.js"></script>
  142. <script src="../js/cell.js"></script>
  143. <script src="../js/slide.js"></script>
  144. <script src="../js/animate.js"></script>
  145. <script src="../js/flickity.js"></script>
  146. <script src="../js/drag.js"></script>
  147. <script src="../js/prev-next-button.js"></script>
  148. <script src="../js/page-dots.js"></script>
  149. <script src="../js/player.js"></script>
  150. <script src="../js/add-remove-cell.js"></script>
  151. <script src="../js/lazyload.js"></script>
  152. <script>
  153. window.onload = function() {
  154. var flky = window.flky = new Flickity( '#full-width' );
  155. // flky.on( 'dragMove', function( event, pointer ) {
  156. // console.log( event.type, pointer.pageX, pointer.pageY );
  157. // });
  158. flky.on( 'select', function() {
  159. console.log('selected', flky.selectedIndex );
  160. });
  161. flky.on( 'settle', function() {
  162. console.log('settled', flky.x );
  163. });
  164. var halfWidthflky = new Flickity( '#half-width', {
  165. cellAlign: 'left'
  166. });
  167. halfWidthflky.on( 'staticClick', function( event, pointer, clickedCellIndex, clickedCellElement ) {
  168. console.log( clickedCellIndex, clickedCellElement );
  169. })
  170. new Flickity( '#gallery3', {
  171. });
  172. document.querySelector('#gallery3 button').onclick = function() {
  173. console.log('button click');
  174. };
  175. };
  176. </script>
  177. </body>
  178. </html>