Simple and cool image slider on your HTML page using CSS and slider.js
As a web developer one always wondering about how to put a simple but attractive image slider on their website's home page, specially when they own an e-commerce like website.
So, here i am going to show you a very simple image slider with a javaScript plugin called swiper plugin. You can check their github repository here.
You need to download plugin from swiper-master github repository (download link may be found in below download section), and link your html with js and css file as mentioned below.
File name : index.html
Working Demo : Here or ( http://paymentmanager.000webhostapp.com/swiper-master/index.html)
So, here i am going to show you a very simple image slider with a javaScript plugin called swiper plugin. You can check their github repository here.
You need to download plugin from swiper-master github repository (download link may be found in below download section), and link your html with js and css file as mentioned below.
File name : index.html
- <!DOCTYPE html>
- <html>
- <head>
- <title>Image Slider</title>
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
- <link rel="stylesheet" type="text/css" href="swiper.min.css">
- <link rel="stylesheet" type="text/css" href="style.css">
- </head>
- <body>
- <!-- Swiper -->
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- <div class="swiper-slide">
- <div class="imgBx">
- <img src="img1.jpg">
- </div>
- <div class="details">
- <h3>Gaurav<br/><span>Web Designer</span></h3>
- </div>
- </div>
- </div>
- <!-- Add Pagination -->
- <div class="swiper-pagination"></div>
- </div>
- </body>
- <script type="text/javascript" src="swiper.min.js"></script>
- <script>
- var swiper = new Swiper('.swiper-container', {
- effect: 'coverflow',
- grabCursor: true,
- centeredSlides: true,
- slidesPerView: 'auto',
- coverflowEffect: {
- rotate: 50,//60
- stretch: 0,
- depth: 100,//500
- modifier: 1,//5
- slideShadows : true,
- },
- pagination: {
- el: '.swiper-pagination',
- },
- });
- </script>
- </html>
- body
- {
- background: #262626;
- font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
- font-size: 14px;
- color:#000;
- margin: 0;
- padding: 0;
- }
- .swiper-container
- {
- width: 100%;
- padding-top: 20px;
- padding-bottom: 50px;
- }
- .swiper-slide {
- background-position: center;
- background-size: cover;
- width: 300px;
- height: 380px;
- background:#fff;
- }
- .swiper-slide .imgBx
- {
- width:100%;
- height:300px;
- overflow:hidden;
- }
- .swiper-slider .imgBx img
- {
- width:100%;
- }
- .swiper-slide .details
- {
- box-sizing: border-box;
- font-size:20px;
- padding:20px;
- }
- .swiper-slide .details h3
- {
- margin:0;
- padding:0;
- font-size:20px;
- text-align:center;
- line-height:20px;
- }
- .swiper-slide .details h3 span
- {
- font-size:16px;
- color:#f44336;
- }
Working Demo : Here or ( http://paymentmanager.000webhostapp.com/swiper-master/index.html)
Comments
Post a Comment