index4.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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; margin: 5px;}
  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. <script src="http://cdn.staticfile.org/jquery/1.8.3/jquery.min.js"></script>
  14. <script src="js/owl.carousel.js"></script>
  15. <script>
  16. $(function(){
  17. $('#owl-demo').owlCarousel({
  18. navigation: true,
  19. navigationText: ["上一个","下一个"]
  20. });
  21. });
  22. </script>
  23. </head>
  24. <body>
  25. <div class="menu">
  26. <p class="menuc">
  27. <span></span>
  28. <a href="./">1、默认</a>
  29. <a href="index2.html">2、单个</a>
  30. <a href="index3.html">3、自动播放</a>
  31. <a class="cur" href="index4.html">4、显示上一张/下一张</a>
  32. <a href="index5.html">5、自适应高度</a>
  33. <a href="index6.html">6、延迟加载(Lazy Load)</a>
  34. <a href="index7.html">7、加载JSON</a>
  35. <a href="index8.html">8、自定义JSON</a>
  36. <a href="index9.html">9、进度条</a>
  37. <a href="index10.html">10、随机显示</a>
  38. </p>
  39. </div>
  40. <div class="main">
  41. <div class="mianc">
  42. <h1>显示上一张/下一张</h1>
  43. <!-- Demo -->
  44. <div id="owl-demo" class="owl-carousel">
  45. <a class="item"><img src="img/owl1.jpg" alt=""></a>
  46. <a class="item"><img src="img/owl2.jpg" alt=""></a>
  47. <a class="item"><img src="img/owl3.jpg" alt=""></a>
  48. <a class="item"><img src="img/owl4.jpg" alt=""></a>
  49. <a class="item"><img src="img/owl5.jpg" alt=""></a>
  50. <a class="item"><img src="img/owl6.jpg" alt=""></a>
  51. <a class="item"><img src="img/owl7.jpg" alt=""></a>
  52. <a class="item"><img src="img/owl8.jpg" alt=""></a>
  53. <a class="item"><img src="img/owl1.jpg" alt=""></a>
  54. <a class="item"><img src="img/owl2.jpg" alt=""></a>
  55. <a class="item"><img src="img/owl3.jpg" alt=""></a>
  56. <a class="item"><img src="img/owl4.jpg" alt=""></a>
  57. <a class="item"><img src="img/owl5.jpg" alt=""></a>
  58. <a class="item"><img src="img/owl6.jpg" alt=""></a>
  59. <a class="item"><img src="img/owl7.jpg" alt=""></a>
  60. <a class="item"><img src="img/owl8.jpg" alt=""></a>
  61. </div>
  62. <!-- Demo end -->
  63. <p class="explain">这是默认样式,文字可以设置,可以修改 CSS 换成常见的箭头形式。</p>
  64. <div class="code">
  65. <h3 class="h31 cur">JavaScript</h3>
  66. <div class="pre">
  67. <pre class="pre-show prettyprint linenums">$(function(){
  68. $('#owl-demo').owlCarousel({
  69. navigation: true,
  70. navigationText: ["上一个","下一个"]
  71. });
  72. });</pre>
  73. </div>
  74. <h3 class="h32">HTML</h3>
  75. <div class="pre">
  76. <pre class="pre-show prettyprint linenums">&lt;div id="owl-demo" class="owl-carousel"&gt;
  77. &lt;a class="item"&gt;&lt;img src="img/owl1.jpg" alt=""&gt;&lt;/a&gt;
  78. &lt;a class="item"&gt;&lt;img src="img/owl2.jpg" alt=""&gt;&lt;/a&gt;
  79. &lt;a class="item"&gt;&lt;img src="img/owl3.jpg" alt=""&gt;&lt;/a&gt;
  80. &lt;a class="item"&gt;&lt;img src="img/owl4.jpg" alt=""&gt;&lt;/a&gt;
  81. &lt;a class="item"&gt;&lt;img src="img/owl5.jpg" alt=""&gt;&lt;/a&gt;
  82. &lt;a class="item"&gt;&lt;img src="img/owl6.jpg" alt=""&gt;&lt;/a&gt;
  83. &lt;a class="item"&gt;&lt;img src="img/owl7.jpg" alt=""&gt;&lt;/a&gt;
  84. &lt;a class="item"&gt;&lt;img src="img/owl8.jpg" alt=""&gt;&lt;/a&gt;
  85. &lt;a class="item"&gt;&lt;img src="img/owl1.jpg" alt=""&gt;&lt;/a&gt;
  86. &lt;a class="item"&gt;&lt;img src="img/owl2.jpg" alt=""&gt;&lt;/a&gt;
  87. &lt;a class="item"&gt;&lt;img src="img/owl3.jpg" alt=""&gt;&lt;/a&gt;
  88. &lt;a class="item"&gt;&lt;img src="img/owl4.jpg" alt=""&gt;&lt;/a&gt;
  89. &lt;a class="item"&gt;&lt;img src="img/owl5.jpg" alt=""&gt;&lt;/a&gt;
  90. &lt;a class="item"&gt;&lt;img src="img/owl6.jpg" alt=""&gt;&lt;/a&gt;
  91. &lt;a class="item"&gt;&lt;img src="img/owl7.jpg" alt=""&gt;&lt;/a&gt;
  92. &lt;a class="item"&gt;&lt;img src="img/owl8.jpg" alt=""&gt;&lt;/a&gt;
  93. &lt;/div&gt;</pre>
  94. </div>
  95. <h3 class="h33">CSS</h3>
  96. <div class="pre">
  97. <pre class="pre-show prettyprint linenums">#owl-demo {
  98. width: 900px;
  99. margin-left: auto;
  100. margin-right: auto;
  101. }
  102. #owl-demo .item {
  103. display: block;
  104. margin: 5px;
  105. }
  106. #owl-demo img {
  107. display: block;
  108. width: 100%;
  109. }</pre>
  110. </div>
  111. </div>
  112. <p class="vad">
  113. <a href="http://www.dowebok.com/" target="_blank">dowebok.com</a>
  114. <a href="http://www.dowebok.com/93.html" target="_blank">说 明</a>
  115. <a href="http://www.dowebok.com/93.html" target="_blank">下 载</a>
  116. </p>
  117. </div>
  118. </div>
  119. <!-- 以下是统计及其他信息,与演示无关,不必理会 -->
  120. <style>
  121. * { margin: 0; padding: 0;}
  122. html, body { height: 100%; overflow: hidden;}
  123. body { font-family: Consolas,arial,"宋体";}
  124. .menu { position: absolute; left: 0; top: 0; width: 200px; height: 100%; background-color: #ccc; font-family: Consolas,arial,"宋体";}
  125. .menuc { height: 100%; overflow-x: hidden; overflow-y: auto;}
  126. .menu span { display: block; height: 100px;}
  127. .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;}
  128. .menu a:hover { background-color: #eee;}
  129. .menu .cur { color: #000; background-color: #fff !important;}
  130. .main { height: 100%; margin-left: 200px;}
  131. .mianc { position: relative; height: 100%; overflow-x: hidden; overflow-y: auto;}
  132. .main h1 { width: 900px; margin: 40px auto; font: 32px "Microsoft Yahei";}
  133. .explain, .dowebok-explain { margin-top: 20px; font-size: 14px; text-align: center; color: #f50;}
  134. .vad { margin: 50px 0 10px; font-family: Consolas,arial,宋体,sans-serif; text-align:center;}
  135. .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;}
  136. .vad a:hover { color: #fff; background-color: #000;}
  137. .thead { width: 728px; height: 90px; margin: 0 auto; border-bottom: 40px solid transparent;}
  138. .code { position: relative; margin-top: 100px; padding-top: 41px;}
  139. .code h3 { position: absolute; top: 0; z-index: 10; width: 100px; height: 40px; font: 16px/40px "Microsoft Yahei"; text-align: center; cursor: pointer;}
  140. .code .cur { border: 1px solid #f0f0f0; border-bottom: 1px solid #f8f8f8; background-color: #f8f8f8;}
  141. .code .h31 { left: 0;}
  142. .code .h32 { left: 102px;}
  143. .code .h33 { left: 204px;}
  144. .code .h34 { left: 306px;}
  145. .code { width: 900px; margin-left: auto; margin-right: auto;}
  146. pre { padding: 15px 0; border: 1px solid #f0f0f0; background-color: #f8f8f8;}
  147. .f-dn { display: none;}
  148. </style>
  149. <link href="http://xww-global.u.qiniudn.com/prettify.css" rel="stylesheet">
  150. <script src="http://xww-global.u.qiniudn.com/prettify.js"></script>
  151. <script>
  152. window.prettyPrint && prettyPrint();
  153. $('.code h3').not(':first').next().addClass('f-dn');
  154. $('.code h3').click(function(){
  155. $(this).addClass('cur').siblings('h3').removeClass('cur');
  156. $(this).next().removeClass('f-dn').siblings('.pre').addClass('f-dn');
  157. });
  158. </script>
  159. </body>
  160. </html>