Giter Club home page Giter Club logo

siema's Introduction

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

siema's People

Contributors

pawelgrzybek avatar codyogden avatar kimruddock avatar mahmoudmy avatar naggi-goishi avatar

Watchers

James Cloos avatar Julien Jolly avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.