spzac主题配置幻灯片教程,超简单

简单的配置一个幻灯片把,响应式+触屏滑动+无限轮播,下面是以spzac主题加上幻灯片的教程

其他主题,稍微参考一下,也可以大致适合的

你可以随便新建一个文件,用来放幻灯片的,然后主题代码里面进行调用,比如typecho里面,我新建了一个为index - hpian.php的文件夹,里面放下面代码:

  1. <link rel="stylesheet" href="<?php $this->options->themeUrl('css/swiper.min.css'); ?>">
  2. <style>
  3. .Swiper_bl{
  4. background-color: white;
  5. padding: 15px;
  6. margin-bottom: 20px;
  7. border-radius: 4px;
  8. border: 1px solid rgba(133,153,171,0.2);
  9. -webkit-box-shadow: 0 2px 26px 0 rgba(133,153,171,0.1);
  10. box-shadow: 0 2px 26px 0 rgba(133,153,171,0.1);
  11. }
  12. .swiper-container {
  13. width: 100%;
  14. height: 100%;
  15. margin-left: auto;
  16. margin-right: auto;
  17. }
  18. .swiper-slide {
  19. text-align: center;
  20. font-size: 18px;
  21. background: #fff;
  22. /* Center slide text vertically */
  23. display: -webkit-box;
  24. display: -ms-flexbox;
  25. display: -webkit-flex;
  26. display: flex;
  27. -webkit-box-pack: center;
  28. -ms-flex-pack: center;
  29. -webkit-justify-content: center;
  30. justify-content: center;
  31. -webkit-box-align: center;
  32. -ms-flex-align: center;
  33. -webkit-align-items: center;
  34. align-items: center;
  35. }
  36. @media screen and (max-width: 767px){
  37. .swiper-slide img{object-fit: cover; width: 100%; height: 100%;}
  38. }
  39. </style>
  40. <!-- Swiper -->
  41. <div class="col-md-12 Swiper_bl">
  42. <div class="swiper-container ">
  43. <div class="swiper-wrapper">
  44. <div class="swiper-slide"><a href="https://www.veimoz.com/85" ><img src="https://xiao.dpaoz.com/spimes1.jpg"></a></div>
  45. <div class="swiper-slide"><a href="https://www.veimoz.com/496" ><img src="https://xiao.dpaoz.com/acg.jpg"></a></div>
  46. <div class="swiper-slide"><a href="https://www.veimoz.com/vipbuy.html" ><img src="https://xiao.dpaoz.com/vip.jpg"></a></div>
  47. </div>
  48. <!-- Add Pagination -->
  49. <div class="swiper-pagination"></div>
  50. <!-- Add Arrows -->
  51. <div class="swiper-button-next"></div>
  52. <div class="swiper-button-prev"></div>
  53. </div>
  54. </div>
  55. <!-- Swiper JS -->
  56. <script src="<?php $this->options->themeUrl('js/swiper.min.js'); ?>"></script>
  57. <!-- Initialize Swiper -->
  58. <script>
  59. var swiper = new Swiper('.swiper-container', {
  60. pagination: '.swiper-pagination',
  61. nextButton: '.swiper-button-next',
  62. prevButton: '.swiper-button-prev',
  63. slidesPerView: 1,
  64. paginationClickable: true,
  65. spaceBetween: 30,
  66. loop: true
  67. });
  68. </script>

里面的结构也很明确

1,加载幻灯片的样式

2,根据自己的主题是调试样式

3,放上轮播幻灯片的结构代码html

4,加载幻灯片的js文件和配置js,如果是spzac主题的话,全部复制就可以了,如果是其他的主题的话,结构html和样式,可能要修改调整一下

然后?

结束了……

源文件什么的,都打包上传了,需要就试试看把

文章由官网发布,如若转载,请注明出处:https://www.veimoz.com/527
0 评论
3.6k

发表评论

小灯泡设计

版权申明:本素材由本站发布,用户购买后只有终端使用权,禁止转售和转载

!