<!--{* banner *}--> <div id="banners" class="banner"> <div class="swiper-container"> <ul class="swiper-wrapper"> {% for value in app('section').id(16079) %} <li class="swiper-slide"> <a href="{{ value.url }}"><img src="{{ value.img | img_format }}" alt="{{ value.name }}" /></a> </li> {% endfor %} </ul> </div> <!-- Add Arrows --> <div class="swiper-button-next"></div> <div class="swiper-button-prev"></div> <!-- Add Pagination --> <div class="btns swiper-pagination-clickable swiper-pagination-bullets"></div> <!-- 自定义分页器 --> <div class="swiper-num"> <span class="active"></span>/ <span class="total"></span> </div> </div> <script> $(function() { var banner_swiper = new Swiper('#banners .swiper-container', { slidesPerView: 1, spaceBetween: 0, autoplay: { delay: 4000,//4秒切换一次 disableOnInteraction: false, }, loop: true, navigation: { nextEl: '#banners .swiper-button-next', prevEl: '#banners .swiper-button-prev', }, // pagination: { // el: '.swiper-pagination2', // type: 'fraction', // }, pagination: { el: '#banners .btns', // type: 'fraction', clickable: true, renderBullet: function (index,className) { // console.log(index) return '<span class="' + className + '">'+ '<svg viewBox="0 0 100 100">'+ '<circle class="init" stroke-width="8" stroke-dasharray="314,0" stroke-linecap="round" fill="none" cx="50" cy="50" r="48" stroke="#fff" />'+ '<circle class="hover" stroke-width="8" stroke-dasharray="314,0" fill="none" cx="50" cy="50" r="48" stroke="#de2012" />'+ '</svg>'+ '</span>'; }, }, }); }) </script> <style> /* banner */ #banners { position: relative; } #banners li a { display: block; } #banners li a img { width: 100%; height: auto; } #banners .swiper-pagination-bullet { width: 17px; height: 17px; background: none; opacity: 1; text-align: center; font-size: 12px; font-weight: normal; font-stretch: normal; line-height: 17px; letter-spacing: 0px; color: #ffffff; text-align: center; border-radius: 0; margin: 0 4px; } #banners .swiper-button-prev, #banners .swiper-button-next { width: 50px; height: 50px; background: none; } #banners .swiper-button-prev::after, #banners .swiper-button-next::after { width: 20px; height: 20px; border-color: transparent transparent #e34b3f #e34b3f; position: relative; left: 0; top: 0; margin: 0; } #banners .swiper-button-prev { left: 3%; } #banners .swiper-button-next { right: 3%; } /* */ .banner .btns { position: absolute; left: 0; bottom: 5.8%; width: 100%; z-index: 3; text-align: center; font-size: 0; } .banner .btns .swiper-pagination-bullet { display: inline-block; *display: inline; zoom: 1; width: 18px; height: 18px; background-color: transparent; position: relative; margin: 0 10px; transform: rotate(-90deg); } .banner .btns .init, .banner .btns .hover { opacity: 0; filter: alpha(opacity=0); } .banner .btns .swiper-pagination-bullet .hover { stroke-dasharray: 314 0; stroke: none; } .banner .btns .swiper-pagination-bullet:before { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; background-color: rgba(255, 255, 255, 1); transform: translate(-50%, -50%); border-radius: 100%; } .banner .btns .swiper-pagination-bullet-active:before { background-color: rgba(255, 255, 255, 1); width: 4px; height: 4px; } .banner .btns .swiper-pagination-bullet-active .init, .banner .btns .swiper-pagination-bullet-active .hover { opacity: 1; filter: alpha(opacity=100); } .banner .btns .swiper-pagination-bullet-active .hover { stroke: #de2012; animation: circle-chart-fill 4s reverse; } @keyframes circle-chart-fill { to { stroke-dasharray: 0 314; } } .swiper-num {position: absolute;width: 165px;left:10%;bottom: 0;z-index: 2; display: none;} .swiper-num .active {display: inline-block;} .swiper-num span {font-size: 32px;} .swiper-num .total {display: inline-block;} /* 插件整体样式修改 */ .slick-arrows { outline: none; } .slick-slide { outline: none; } .swiper-button-prev, .swiper-button-next { outline: none; } .swiper-button-prev, .swiper-button-next { outline: none; display: flex; width: 24px; height: 44px; justify-content: center; align-items: center; overflow: hidden; } .swiper-button-prev::after, .swiper-button-next::after { content: ""; background: none; display: block; width: 40px; height: 40px; border: 2px solid #ffffff; position: absolute; transform: rotate(45deg); -webkit-transform: rotate(45deg); left: 12px; top: 50%; margin-top: -20px; } .swiper-button-next { transform: rotate(180deg); -webkit-transform: rotate(180deg); } .swiper-pagination2 { position: absolute; width: 100%; display: flex; justify-content: center; align-items: center; bottom: 5%; font-size: 16px; color: #fff; z-index: 9; } .swiper-pagination2 .swiper-pagination-bullet { outline: none; margin: 0 1em; } @media(max-width:992px) { .swiper-button-prev, .swiper-button-next { display: none; } } </stle>
上一篇:svg swiper
下一篇:已经是最后一篇