Skip to content
/ siema Public
forked from pawelgrzybek/siema

Siema - Lightweight and simple carousel in pure JavaScript

License

Notifications You must be signed in to change notification settings

JulienJo/siema

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Siema - Lightweight and simple carousel with no dependencies

Full docs with examples: https://pawelgrzybek.com/siema/.

Siema is a lightweight (only 1kb gzipped) carousel plugin with no dependencies and no styling. As Brad Frost once said "do that shit yourself". It is 100% open source and available on Github. It is free to use on personal and commercial projects. Use it with your favourite module bundler or by manually injecting the script into your project.

Installation

Setup is trivially easy. A little bit of markup...

<div class="siema">
  <div>Hi, I'm slide 1</div>
  <div>Hi, I'm slide 2</div>
  <div>Hi, I'm slide 3</div>
  <div>Hi, I'm slide 4</div>
</div>

If you are using a module bundler like Webpack or Browserify...

npm i -S siema

// or

yarn add siema
import Siema from 'siema';
new Siema();

...or manually inject the minified script into your website.

<script src="siema.min.js"></script>
<script>
  new Siema();
</script>

Options

Siema comes with a few (optional) settings that you can change by passing an object as an argument. Default values are presented below.

new Siema({
  selector: '.siema',
  duration: 200,
  easing: 'ease-out',
  perPage: 1,
  startIndex: 0,
  draggable: true,
  threshold: 20,
  loop: false,
});
  • selector - (string or DOM element) specify the selector
  • duration - (number) slide transition duration (in ms)
  • easing - (string) the same as transition-timing-function in CSS
  • perPage - (number or object) the number of slides to be shown
  • startIndex - (number) index of the starting slide (zero-based)
  • draggable - (boolean) use dragging and touch swiping
  • threshold - (number) touch and mouse dragging threshold (in px)
  • loop - (boolean) loop the slides around

API

As mentioned above, Siema doesn't come with many options - just a few useful methods. Combine it with some very basic JavaScript and voila!

  • next() - go to next slide
  • prev() - go to previous slide
  • goTo(index) - go to a specific slide
  • destroy() - remove all active listeners
  • currentSlide - index of the current active slide (read only)

Browser support

  • IE10
  • Chrome 12
  • Firefox 16
  • Opera 15
  • Safari 4
  • Android Browser 4.0
  • iOS Safari 6.0

About

Siema - Lightweight and simple carousel in pure JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 56.3%
  • JavaScript 36.1%
  • CSS 7.6%