index5.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery幻灯片插件Owl Carousel演示-自适应高度_dowebok</title>
  6. <style>
  7. #owl-demo { width: 900px; margin-left: auto; margin-right: auto;}
  8. #owl-demo .item{ display: block;}
  9. #owl-demo img { display: block; width: 100%;}
  10. </style>
  11. <link href="css/owl.carousel.css" rel="stylesheet">
  12. <link href="css/owl.theme.css" rel="stylesheet">
  13. <link href="css/owl.transitions.css" rel="stylesheet">
  14. <script src="http://cdn.staticfile.org/jquery/1.8.3/jquery.min.js"></script>
  15. <script src="js/owl.carousel.js"></script>
  16. <script>
  17. $(function(){
  18. $('#owl-demo').owlCarousel({
  19. items: 1,
  20. autoPlay: 3000,
  21. autoHeight: true,
  22. transitionStyle: 'fade'
  23. });
  24. });
  25. </script>
  26. </head>
  27. <body>
  28. <div class="menu">
  29. <p class="menuc">
  30. <span></span>
  31. <a href="./">1、默认</a>
  32. <a href="index2.html">2、单个</a>
  33. <a href="index3.html">3、自动播放</a>
  34. <a href="index4.html">4、显示上一张/下一张</a>
  35. <a class="cur" href="index5.html">5、自适应高度</a>
  36. <a href="index6.html">6、延迟加载(Lazy Load)</a>
  37. <a href="index7.html">7、加载JSON</a>
  38. <a href="index8.html">8、自定义JSON</a>
  39. <a href="index9.html">9、进度条</a>
  40. <a href="index10.html">10、随机显示</a>
  41. </p>
  42. </div>
  43. <div class="main">
  44. <div class="mianc">
  45. <h1>自适应高度</h1>
  46. <!-- Demo -->
  47. <div id="owl-demo" class="owl-carousel">
  48. <a class="item"><img src="img/900x300.png" alt=""></a>
  49. <a class="item"><img src="img/900x500.png" alt=""></a>
  50. <a class="item"><img src="img/900x200.png" alt=""></a>
  51. <a class="item"><img src="img/900x400.png" alt=""></a>
  52. </div>
  53. <!-- Demo end -->
  54. <div class="code">
  55. <h3 class="h31 cur">JavaScript</h3>
  56. <div class="pre">
  57. <pre class="pre-show prettyprint linenums">$(function(){
  58. $('#owl-demo').owlCarousel({
  59. items: 1,
  60. autoPlay: 3000,
  61. autoHeight: true,
  62. transitionStyle: 'fade'
  63. });
  64. });</pre>
  65. </div>
  66. <h3 class="h32">HTML</h3>
  67. <div class="pre">
  68. <pre class="pre-show prettyprint linenums">&lt;div id="owl-demo" class="owl-carousel"&gt;
  69. &lt;a class="item"&gt;&lt;img src="img/900x300.png" alt=""&gt;&lt;/a&gt;
  70. &lt;a class="item"&gt;&lt;img src="img/900x500.png" alt=""&gt;&lt;/a&gt;
  71. &lt;a class="item"&gt;&lt;img src="img/900x200.png" alt=""&gt;&lt;/a&gt;
  72. &lt;a class="item"&gt;&lt;img src="img/900x400.png" alt=""&gt;&lt;/a&gt;
  73. &lt;/div&gt;</pre>
  74. </div>
  75. <h3 class="h33">CSS</h3>
  76. <div class="pre">
  77. <pre class="pre-show prettyprint linenums">#owl-demo {
  78. width: 900px;
  79. margin-left: auto;
  80. margin-right: auto;
  81. }
  82. #owl-demo .item {
  83. display: block;
  84. }
  85. #owl-demo img {
  86. display: block;
  87. width: 100%;
  88. }</pre>
  89. </div>
  90. </div>
  91. <p class="vad">
  92. <a href="http://www.dowebok.com/" target="_blank">dowebok.com</a>
  93. <a href="http://www.dowebok.com/93.html" target="_blank">说 明</a>
  94. <a href="http://www.dowebok.com/93.html" target="_blank">下 载</a>
  95. </p>
  96. </div>
  97. </div>
  98. <!-- 以下是统计及其他信息,与演示无关,不必理会 -->
  99. <style>
  100. * { margin: 0; padding: 0;}
  101. html, body { height: 100%; overflow: hidden;}
  102. body { font-family: Consolas,arial,"宋体";}
  103. .menu { position: absolute; left: 0; top: 0; width: 200px; height: 100%; background-color: #ccc; font-family: Consolas,arial,"宋体";}
  104. .menuc { height: 100%; overflow-x: hidden; overflow-y: auto;}
  105. .menu span { display: block; height: 100px;}
  106. .menu a { display: block; height: 40px; margin: 0 0 1px 2px; padding-left: 10px; line-height: 40px; font-size: 14px; color: #333; text-decoration: none;}
  107. .menu a:hover { background-color: #eee;}
  108. .menu .cur { color: #000; background-color: #fff !important;}
  109. .main { height: 100%; margin-left: 200px;}
  110. .mianc { position: relative; height: 100%; overflow-x: hidden; overflow-y: auto;}
  111. .main h1 { width: 900px; margin: 40px auto; font: 32px "Microsoft Yahei";}
  112. .explain, .dowebok-explain { margin-top: 20px; font-size: 14px; text-align: center; color: #f50;}
  113. .vad { margin: 50px 0 10px; font-family: Consolas,arial,宋体,sans-serif; text-align:center;}
  114. .vad a { display: inline-block; height: 36px; line-height: 36px; margin: 0 5px; padding: 0 50px; font-size: 14px; text-align:center; color:#eee; text-decoration: none; background-color: #222;}
  115. .vad a:hover { color: #fff; background-color: #000;}
  116. .thead { width: 728px; height: 90px; margin: 0 auto; border-bottom: 40px solid transparent;}
  117. .code { position: relative; margin-top: 100px; padding-top: 41px;}
  118. .code h3 { position: absolute; top: 0; z-index: 10; width: 100px; height: 40px; font: 16px/40px "Microsoft Yahei"; text-align: center; cursor: pointer;}
  119. .code .cur { border: 1px solid #f0f0f0; border-bottom: 1px solid #f8f8f8; background-color: #f8f8f8;}
  120. .code .h31 { left: 0;}
  121. .code .h32 { left: 102px;}
  122. .code .h33 { left: 204px;}
  123. .code .h34 { left: 306px;}
  124. .code { width: 900px; margin-left: auto; margin-right: auto;}
  125. pre { padding: 15px 0; border: 1px solid #f0f0f0; background-color: #f8f8f8;}
  126. .f-dn { display: none;}
  127. </style>
  128. <link href="http://xww-global.u.qiniudn.com/prettify.css" rel="stylesheet">
  129. <script src="http://xww-global.u.qiniudn.com/prettify.js"></script>
  130. <script>
  131. window.prettyPrint && prettyPrint();
  132. $('.code h3').not(':first').next().addClass('f-dn');
  133. $('.code h3').click(function(){
  134. $(this).addClass('cur').siblings('h3').removeClass('cur');
  135. $(this).next().removeClass('f-dn').siblings('.pre').addClass('f-dn');
  136. });
  137. </script>
  138. </body>
  139. </html>