UNPKG

swiper

Version:

Mobile touch slider and framework with hardware accelerated transitions

159 lines 3.34 kB
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Demo</title> <link rel="stylesheet" href="../dist/idangerous.swiper.css"> <style> /* Demo Styles */ body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.5; } .device { width: 660px; position: relative; margin: 10px auto; height: 250px; padding: 30px 40px; border-radius: 20px; background: #000; border:3px solid #fff; box-shadow: 0px 0px 5px #000; } .swiper-container { width: 660px; height: 250px; color: #fff; background: #222; text-align: center; } .swiper-slide { height: 100%; opacity: 0.4; -webkit-transition: 300ms; -moz-transition: 300ms; -ms-transition: 300ms; -o-transition: 300ms; transition: 300ms; -webkit-transform: scale(0); -moz-transform: scale(0); -ms-transform: scale(0); -o-transform: scale(0); transform: scale(0); } .swiper-slide-visible { opacity: 0.5; -webkit-transform: scale(0.8); -moz-transform: scale(0.8); -ms-transform: scale(0.8); -o-transform: scale(0.8); transform: scale(0.8); } .swiper-slide-active { top: 0; opacity: 1; -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); -o-transform: scale(1); transform: scale(1); } .red-slide { background: #ca4040; } .blue-slide { background: #4390ee; } .orange-slide { background: #ff8604; } .green-slide { background: #49a430; } .pink-slide { background: #973e76; } .swiper-slide .title { font-style: italic; font-size: 42px; margin-top: 80px; margin-bottom: 0; line-height: 45px; } .pagination { position: absolute; z-index: 20; left: 0px; width: 100%; text-align: center; bottom: 5px; } .swiper-pagination-switch { display: inline-block; width: 10px; height: 10px; border-radius: 8px; background: #aaa; margin-right: 8px; cursor: pointer; -webkit-transition: 300ms; -moz-transition: 300ms; -ms-transition: 300ms; -o-transition: 300ms; transition: 300ms; opacity: 0; position: relative; top: -50px; } .swiper-visible-switch { opacity: 1; top: 0; background: #aaa; } .swiper-active-switch { background: #fff; } </style> </head> <body> <div class="device"> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide red-slide"> <div class="title">Slide 1</div> </div> <div class="swiper-slide blue-slide"> <div class="title">Slide 2</div> </div> <div class="swiper-slide orange-slide"> <div class="title">Slide 3</div> </div> <div class="swiper-slide blue-slide"> <div class="title">Slide 4</div> </div> <div class="swiper-slide red-slide"> <div class="title">Slide 5</div> </div> <div class="swiper-slide green-slide"> <div class="title">Slide 6</div> </div> </div> </div> <div class="pagination"></div> </div> <script src="js/jquery-1.10.1.min.js"></script> <script src="../dist/idangerous.swiper.min.js"></script> <script> var mySwiper = new Swiper('.swiper-container',{ pagination: '.pagination', paginationClickable: true, centeredSlides: true, slidesPerView: 3, watchActiveIndex: true }) </script> </body> </html>