spzac主题配置幻灯片教程,超简单
简单的配置一个幻灯片把,响应式+触屏滑动+无限轮播,下面是以spzac主题加上幻灯片的教程
其他主题,稍微参考一下,也可以大致适合的
你可以随便新建一个文件,用来放幻灯片的,然后主题代码里面进行调用,比如typecho里面,我新建了一个为index - hpian.php的文件夹,里面放下面代码:
- <link rel="stylesheet" href="<?php $this->options->themeUrl('css/swiper.min.css'); ?>">
- <style>
- .Swiper_bl{
- background-color: white;
- padding: 15px;
- margin-bottom: 20px;
- border-radius: 4px;
- border: 1px solid rgba(133,153,171,0.2);
- -webkit-box-shadow: 0 2px 26px 0 rgba(133,153,171,0.1);
- box-shadow: 0 2px 26px 0 rgba(133,153,171,0.1);
-
- }
- .swiper-container {
- width: 100%;
- height: 100%;
- margin-left: auto;
- margin-right: auto;
-
- }
- .swiper-slide {
- text-align: center;
- font-size: 18px;
- background: #fff;
-
- /* Center slide text vertically */
- display: -webkit-box;
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
- }
- @media screen and (max-width: 767px){
- .swiper-slide img{object-fit: cover; width: 100%; height: 100%;}
- }
-
- </style>
- <!-- Swiper -->
- <div class="col-md-12 Swiper_bl">
- <div class="swiper-container ">
- <div class="swiper-wrapper">
-
- <div class="swiper-slide"><a href="https://www.veimoz.com/85" ><img src="https://xiao.dpaoz.com/spimes1.jpg"></a></div>
- <div class="swiper-slide"><a href="https://www.veimoz.com/496" ><img src="https://xiao.dpaoz.com/acg.jpg"></a></div>
- <div class="swiper-slide"><a href="https://www.veimoz.com/vipbuy.html" ><img src="https://xiao.dpaoz.com/vip.jpg"></a></div>
-
- </div>
- <!-- Add Pagination -->
- <div class="swiper-pagination"></div>
- <!-- Add Arrows -->
- <div class="swiper-button-next"></div>
- <div class="swiper-button-prev"></div>
- </div>
- </div>
-
- <!-- Swiper JS -->
-
- <script src="<?php $this->options->themeUrl('js/swiper.min.js'); ?>"></script>
-
- <!-- Initialize Swiper -->
- <script>
- var swiper = new Swiper('.swiper-container', {
- pagination: '.swiper-pagination',
- nextButton: '.swiper-button-next',
- prevButton: '.swiper-button-prev',
- slidesPerView: 1,
- paginationClickable: true,
- spaceBetween: 30,
- loop: true
- });
- </script>
里面的结构也很明确
1,加载幻灯片的样式
2,根据自己的主题是调试样式
3,放上轮播幻灯片的结构代码html
4,加载幻灯片的js文件和配置js,如果是spzac主题的话,全部复制就可以了,如果是其他的主题的话,结构html和样式,可能要修改调整一下
然后?
结束了……
源文件什么的,都打包上传了,需要就试试看把
文章由官网发布,如若转载,请注明出处:https://www.veimoz.com/527
0 评论
3.6k