adaptive-height.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width" />
  6. <title>slides</title>
  7. <link rel="stylesheet" href="../css/flickity.css" />
  8. <style>
  9. * { box-sizing: border-box; }
  10. html { overflow-y: scroll; }
  11. .carousel {
  12. border: 1px solid;
  13. margin-bottom: 40px;
  14. }
  15. .flickity-viewport {
  16. overflow: visible;
  17. transition: height 0.2s;
  18. }
  19. .carousel__cell {
  20. width: 32%;
  21. height: 100px;
  22. background: #BDF;
  23. margin-left: 1%;
  24. margin-right: 1%;
  25. font-size: 40px;
  26. }
  27. .carousel__cell.is-selected {
  28. background: #68F;
  29. }
  30. .carousel__cell--height2 { height: 200px; }
  31. .carousel__cell--height3 { height: 300px; }
  32. .carousel__cell--height4 { height: 400px; }
  33. /* ---- ---- */
  34. .image-carousel img {
  35. display: block;
  36. width: 50%;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <h1>slides</h1>
  42. <div class="carousel carousel1">
  43. <div class="carousel__cell carousel__cell--height2">0</div>
  44. <div class="carousel__cell">1</div>
  45. <div class="carousel__cell">2</div>
  46. <div class="carousel__cell carousel__cell--height2">3</div>
  47. <div class="carousel__cell carousel__cell--height3">4</div>
  48. <div class="carousel__cell">5</div>
  49. <div class="carousel__cell carousel__cell--height4">6</div>
  50. <div class="carousel__cell">7</div>
  51. <div class="carousel__cell carousel__cell--height3">8</div>
  52. <div class="carousel__cell">9</div>
  53. <div class="carousel__cell">10</div>
  54. </div>
  55. <div class="carousel image-carousel">
  56. <img src="http://i.imgur.com/r8p3Xgq.jpg" />
  57. <img src="http://i.imgur.com/q9zO6tw.jpg" />
  58. <img src="http://i.imgur.com/bwy74ok.jpg" />
  59. <img src="http://i.imgur.com/bAZWoqx.jpg" />
  60. <img src="http://i.imgur.com/PgmEBSB.jpg" />
  61. <img src="http://i.imgur.com/aboaFoB.jpg" />
  62. <img src="http://i.imgur.com/LkmcILl.jpg" />
  63. <img src="http://i.imgur.com/hODreXI.jpg" />
  64. <img src="http://i.imgur.com/UORFJ3w.jpg" />
  65. </div>
  66. <script src="../bower_components/get-size/get-size.js"></script>
  67. <script src="../bower_components/desandro-matches-selector/matches-selector.js"></script>
  68. <script src="../bower_components/ev-emitter/ev-emitter.js"></script>
  69. <script src="../bower_components/unipointer/unipointer.js"></script>
  70. <script src="../bower_components/unidragger/unidragger.js"></script>
  71. <script src="../bower_components/fizzy-ui-utils/utils.js"></script>
  72. <script src="../js/cell.js"></script>
  73. <script src="../js/slide.js"></script>
  74. <script src="../js/animate.js"></script>
  75. <script src="../js/flickity.js"></script>
  76. <script src="../js/drag.js"></script>
  77. <script src="../js/prev-next-button.js"></script>
  78. <script src="../js/page-dots.js"></script>
  79. <script src="../js/player.js"></script>
  80. <script src="../js/add-remove-cell.js"></script>
  81. <script src="../js/lazyload.js"></script>
  82. <script>
  83. var flkty = new Flickity( '.carousel1', {
  84. adaptiveHeight: true,
  85. // groupCells: true,
  86. // wrapAround: true,
  87. });
  88. var imgFlkty = new Flickity( '.image-carousel', {
  89. adaptiveHeight: true
  90. });
  91. window.onload = function() {
  92. imgFlkty.reposition();
  93. }
  94. </script>
  95. </body>
  96. </html>