Git Product home page Git Product logo

grease's Introduction

Grease

An ES6 Vanilla JS Carousel


Alpha - This project is still in development, and as such, probably isn't stable for use in production yet. When the time comes, a 1.0 release will be made, and it possibly will be made available as an npm module.

Getting Started

Include the Grease CSS file, and the the Grease JavaScript,

<link rel="stylesheet" src="dist/style.css">

...

<div id="grease-carousel">
  <div>Slide 1</div>
  <div>Slide 2</div>
  <div>Slide 3</div>
  <div>Slide 4</div>
</div>

...

<script src="dist/grease.js"></script>

Initialize Grease

<script>
  const carousel = document.getElementById('grease-carousel');
  const grease = new Grease( carousel, options );
</script>

Options

  • fade (default: false)
  • buttons (default: true)
  • captions (default: false)
  • dots (default: false)
  • ease (default: 'ease')
  • infinite (default: false)
  • ticker (default: false)
  • slidesToShow (default: 1)
  • slidesToScroll (default: 1)
  • speed (in milliseconds - default: 300)
  • breakpoint (default: 640)
  • matchHeightClass
<script>
  const grease = new Grease( carousel, {
  	fade: true,
  	dots: true
  });
</script>

toDo

  • autoplay
  • prev/next labels

Events

  • init
  • nextSlide
  • previousSlide
  • resize
grease.on('nextSlide', () => {
  // do stuff
});

Methods

todo

Captions

<div id="grease-carousel">
  <div data-caption="caption 1">Slide 1</div>
  <div data-caption="caption 2">Slide 2</div>
  <div data-caption="caption 3">Slide 3</div>
  <div data-caption="caption 4">Slide 4</div>
</div>

...

<script>
  const carousel = document.getElementById('grease-carousel');
  const grease = new Grease( carousel, {
    captions: true
  });
</script>

© 2017 Michael LaRoy. Find me on Twitter @laroymike

grease's People

Watchers

 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.