Git Product home page Git Product logo

sly's Introduction

Sly

A tiny, 2k responsive slider using CSS3 built with Javascript. its built with newer ecmascript 6 elements to keep it tiny so its only build for modern browsers (Chrome, Firebox, IE10+).

There is also a polyfilled version for IE

Get Started

Add your markup

 <div id="slider">
     <div class="slide"></div>
     <div class="slide"></div>
     <div class="slide"></div>
     <div class="slide"></div>
 </div>

Add some CSS. The width of the slider can be whatever you want, its responsive!

 #slider {
     height: 600px;
     overflow: hidden;
     position: relative;
 }

 .slide {
     width: 100%;
     float: left;
 }

Fire her up! Add the ID of your slider into the function

var sly = new Sly('slider');

With options

 var sly = new Sly('slider', {
     bullets: 'slide-navigation', // ID of element to inject bullet nav into - default is false
     speed: '0.5' // Slide Transition Speed - default speed is 0.5
     easing: 'cubic-bezier(0.77, 0, 0.175, 1)' // custom CSS easing - defaults to ease
     auto: 3000 // Autoplay - Takes an interval in milliseconds - defaults to false
 });
 

API methods

For the moment, just some simple Next, Previous controls

sly.next();
sly.prev();

Polyfilled Version

There is now a polyfilled version on the dist folder that includes polyfills for forEach, filter and addEventListener which fix older browsers with missing features or inconsistencies.

This does not cover the CSS3 animations. At the moment older browsers will slide the images without the animation. In upcoming versions there may either be a fix to fall back to javascript animations or event triggering to allow your own javscript animations.

Todo's

  1. Options for Speed, Easing
  2. Better support for IE Polyfill version now available
  3. More API methods
  4. Smaller File Size

Development

Simple as npm install. Make sure you have gulp installed globally beforehand.

Gulp comes with 3 tasks:

gulp less

for compiling LESS to CSS, minifying and saving to /CSS/style.css

gulp build

for compiling /src/sly.js to /dist/sly.min.js

gulp build:polyfill

for compiling /src/sly.js + /src/polyfills.js to /dist/sly.polyfilled.min.js

gulp watch

Exactly what it says on the tin. Watch for changes to both js and less files and runs both Less and build

gulp run

Everything together. Fires up the webserver on localhost:8000 and listens for changes. Fires livereload when everything is compiled.

Fork away!

sly's People

Contributors

wurren avatar

Watchers

 avatar James Cloos 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.