All Projects → michu2k → SimpleSlider

michu2k / SimpleSlider

Licence: MIT license
Simple responsive slider created in pure javascript.

Programming Languages

javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to SimpleSlider

Keen Slider
The HTML touch slider carousel with the most native feeling
Stars: ✭ 3,097 (+14647.62%)
Mutual labels:  slideshow, slider, carousel
Slider
Touch swipe image slider/slideshow/gallery/carousel/banner mobile responsive bootstrap
Stars: ✭ 2,046 (+9642.86%)
Mutual labels:  slideshow, slider, carousel
Embla Carousel
A lightweight carousel library with fluid motion and great swipe precision.
Stars: ✭ 1,874 (+8823.81%)
Mutual labels:  slideshow, slider, carousel
svelte-slidy
📸 Sliding action script
Stars: ✭ 211 (+904.76%)
Mutual labels:  slideshow, slider, carousel
Ngx Gallery
Angular Gallery, Carousel and Lightbox
Stars: ✭ 417 (+1885.71%)
Mutual labels:  slideshow, carousel
Ken Burns Carousel
🌄 A web component that displays a set of images with a ken burns effect
Stars: ✭ 106 (+404.76%)
Mutual labels:  slideshow, carousel
Noodel Js
User interface for responsive, dynamic content trees
Stars: ✭ 173 (+723.81%)
Mutual labels:  slideshow, carousel
Vue Infinite Slide Bar
∞ Infinite slide bar component (no dependency and light weight 1.48 KB)
Stars: ✭ 190 (+804.76%)
Mutual labels:  slideshow, slider
Vueper Slides
A touch ready and responsive slideshow / carousel for Vue & Vue 3.
Stars: ✭ 319 (+1419.05%)
Mutual labels:  slideshow, carousel
Jcarousel
Riding carousels with jQuery.
Stars: ✭ 2,031 (+9571.43%)
Mutual labels:  slideshow, carousel
vue-splide
The Splide component for Vue.
Stars: ✭ 257 (+1123.81%)
Mutual labels:  slider, carousel
Nodeppt
This is probably the best web presentation tool so far!
Stars: ✭ 9,589 (+45561.9%)
Mutual labels:  slideshow, javascript-library
Slendr
A responsive & lightweight (2KB gzipped) slider for modern browsers. [UNMAINTAINED]
Stars: ✭ 39 (+85.71%)
Mutual labels:  slideshow, slider
SimpleSlider
A simple slider allows you to easily use.
Stars: ✭ 78 (+271.43%)
Mutual labels:  slider, simpleslider
react-instagram-zoom-slider
🌄↔️ A slider component with pinch to zoom capabilities inspired by Instagram
Stars: ✭ 67 (+219.05%)
Mutual labels:  slider, carousel
Why-Not-Image-Carousel
Why Not use Image Carousel if you have lots of images to show!
Stars: ✭ 310 (+1376.19%)
Mutual labels:  slideshow, carousel
angular-simple-slider
An AngularJS directive providing a simple slider functionality
Stars: ✭ 15 (-28.57%)
Mutual labels:  slider, carousel
previewSlider
Responsive fullscreen image slider where the users are able to preview next/previous image when hovering over the navigation arrows.
Stars: ✭ 16 (-23.81%)
Mutual labels:  slideshow, javascript-library
Skitter
Skitter - Slideshow for anytime
Stars: ✭ 295 (+1304.76%)
Mutual labels:  slideshow, slider
MediaSliderView
Pure java based, highly customizable media slider gallery supporting both images and videos for android.
Stars: ✭ 85 (+304.76%)
Mutual labels:  slider, carousel

SimpleSlider

Simple responsive slider created in pure javascript.
Browsers support: All modern browsers, Internet Explorer 10+

Version

1.9.0

Installation

npm

Install the package & import files

npm install simpleslider-js
import SimpleSlider from 'simpleslider-js';
import 'simpleslider-js/dist/simpleslider.min.css';
CDN

Include files using CDN.

https://unpkg.com/[email protected]/dist/simpleSlider.min.js
https://unpkg.com/[email protected]/dist/simpleSlider.min.css
Github

You can also download files from Github and attach them manually to your project.
Note: On production use files (JS and CSS) only from dist/ folder.

<link rel="stylesheet" href="css/simpleSlider.min.css"> 
<script src="js/simpleSlider.min.js"></script>  

Usage

Include files

See the section above.

Create HTML layout
<div class="simple-slider simple-slider-first">
  <div class="slider-wrapper">
    <!-- First slide -->
    <div class="slider-slide" style="background-image: url('path/to/image')">
      <!-- Any HTML content -->
    </div>

    <!-- Second slide -->
    <div class="slider-slide" style="background-image: url('path/to/image')">
      <!-- Any HTML content -->
    </div>

    <!-- Third slide -->
    <div class="slider-slide" style="background-image: url('path/to/image')">
      <!-- Any HTML content -->
    </div>
  </div>

  <!--Pagination (Not required)-->
  <div class="slider-pagination"></div>

  <!-- Buttons (Not required) -->
  <div class="slider-btn slider-btn-prev"></div>
  <div class="slider-btn slider-btn-next"></div> 
</div>
Initialize the module
<script>
  new SimpleSlider('.simple-slider-first');
</script>

API

Example

new SimpleSlider(container, options)

  • container - string (required), selector of slider container
  • options - object (optional), slider options

You can initialize more than one slider per page.

<script>
  // Default options
  new SimpleSlider('.simple-slider-first');  

  // User options
  new SimpleSlider('.simple-slider-second', {
    speed: 600,
    autoplay: false,
    class: {
      wrapper: 'slider-wrapper'
    },
    onChange: function() {
      console.log('Slide changed !');
    }
  });

  // SlidesPerView example
  new SimpleSlider('.simple-slider-third', {
    slidesPerView: {
      768: 2, // 2 slides for viewport >= 768px
      1024: 3 // 3 slides for viewport >= 1024px
    }
  });
  
  // Access to other slider functions and properties
  var slider = new SimpleSlider('.simple-slider-third');
  console.log(slider);
</script>
Options
Option Type Default value Description
speed number 600 Transition duration in ms
delay number 5000 Delay between transitions in ms (autoplay)
enableDrag boolean true Enable drag option
autoplay boolean false Slider autoplay
loop boolean true Slider loop
slidesPerView object 1 The number of slides to be shown [Read more below]
class:wrapper string 'slider-wrapper' Wrapper class
class:slide string 'slider-slide' Slide class
class:buttons string 'slider-btn' Buttons class
class:pagination string 'slider-pagination' Pagination class
class:paginationItem string 'pagination-bullet' Pagination bullet class
onInit function - Function called after slider initialization
onChange function - Function called when the slide change start
Other functions and properties

.attachEvents() - Attach all events
.detachEvents() - Detach all events
.nextSlide() - Go to the next slide
.prevSlide() - Go to the previous slide
.index - Get current slide index
.wrapper - Slider wrapper
.container - Slider container
.buttons - Slider buttons
.slides - List of slides
.slidesWithClones - List of slides with clones
.paginationBullets - List of pagination bullets

Comments

slidesPerView - Number of slides can't be bigger than the amount of slides in the slider.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].