Created
June 9, 2019 11:45
-
-
Save DevShahidul/e3826475d8662adce351fe9e94ae1ec0 to your computer and use it in GitHub Desktop.
See the example here >>> https://stackoverflow.com/questions/32196177/showing-number-of-slides-on-the-web-page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no"> | |
<meta name="format-detection" content="telephone=no"> | |
<title>VMR | About</title> | |
<style> | |
#numberSlides{ | |
position: absolute; | |
bottom: 0; | |
left: 0; | |
z-index: 9999; | |
} | |
html, | |
body { | |
position: relative; | |
height: 100%; | |
} | |
body { | |
background: #eee; | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-size: 14px; | |
color: #000; | |
margin: 0; | |
padding: 0; | |
} | |
.swiper-container { | |
width: 100%; | |
height: 100%; | |
} | |
.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; | |
} | |
</style> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.1.2/js/swiper.js"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.1.2/css/swiper.css"> | |
</head> | |
<body> | |
<div class="swiper-container"> | |
<div class="swiper-wrapper"> | |
<div class="swiper-slide">Slide 1</div> | |
<div class="swiper-slide">Slide 2</div> | |
<div class="swiper-slide">Slide 3</div> | |
<div class="swiper-slide">Slide 4</div> | |
<div class="swiper-slide">Slide 5</div> | |
<div class="swiper-slide">Slide 6</div> | |
<div class="swiper-slide">Slide 7</div> | |
<div class="swiper-slide">Slide 8</div> | |
<div class="swiper-slide">Slide 9</div> | |
<div class="swiper-slide">Slide 10</div> | |
</div> | |
<!-- Add Pagination --> | |
<div class="swiper-pagination swiper-pagination-clickable"></div> | |
<div id="numberSlides"> | |
0/0 Offers | |
</div> | |
</div> | |
<script type="text/javascript"> | |
var swiper = new Swiper('.swiper-container', { | |
pagination: '.swiper-pagination', | |
paginationClickable: true, | |
nextButton: '.swiper-button-next', | |
prevButton: '.swiper-button-prev', | |
spaceBetween: 30, | |
centeredSlides: true, | |
autoplay: 3000, | |
autoplayDisableOnInteraction: false, | |
runCallbacksOnInit: true, | |
onInit: function(sw){ | |
var offer = document.querySelector('#numberSlides'); | |
offer.innerHTML = (sw.activeIndex + 1) + '/' + sw.slides.length + 'Offers'; | |
}, | |
onSlideChangeEnd: function(sw){ | |
var offer = document.querySelector('#numberSlides'); | |
offer.innerHTML = (sw.activeIndex + 1) + '/' + sw.slides.length + 'Offers'; | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment