Responsive Fading Slideshow In JavaScript – smerf-slider

Category: Javascript , Slideshow | September 17, 2017
Author:zgrybus
Views Total:1,531 views
Official Page:Go to website
Last Update:September 17, 2017
License:MIT

Preview:

Responsive Fading Slideshow In JavaScript – smerf-slider

Description:

The smerf-slider JavaScript library enables you to create responsive, cross-fading slideshow with easing support.

How to use it:

Create the slides in the webpage.

<div class="smerf-container example">
  <div class="smerf-item">1</div>
  <div class="smerf-item">2</div>
  <div class="smerf-item">3</div>
  <div class="smerf-item">4</div>
  <div class="smerf-item">5</div>
  ...
</div>

Insert the JavaScript file ‘smerf-slider.js’ into the webpage.

<script src="smerf-slider.js"></script>

Make the slideshow responsive using CSS flexbox.

.smerf-container {
  position: relative;
  width: 90%;
  margin: auto;
  height: 300px;
  margin-top: 30px;
}
.smerf-item {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  font-size: 40px;
  color: white;
  border: 6px solid white;
  box-shadow: 0 0 3px 2px black;
  transition-property: opacity;
}

Activate the slideshow.

SmerfSlider.startLibrary({
  container: 'example'
});

All default configurations.

SmerfSlider.startLibrary({
  container: 'smerf-container',
  items: 'smerf-item',
  transitionDuration: '300',
  transitionFunction: 'ease-in',
  timeInterval: '5000',
  animationType: 'fade',
  type: 'auto',
  startAt: 0
});

You Might Be Interested In:


Leave a Reply