Coder Social home page Coder Social logo

-cs-spinner's Introduction

#(cs)spinner

###Pure CSS loading animations with minimal effort!

alt tag

Demo

here.

Basic usage

  1. Include the stylesheet(tweaking where necessary).
  2. Add and remove appropriate classes to your elements when necessary to show loading(using js).

That's it!

  <div class="csspinner duo">
    This content is taking ages to load.
  </div>

####options From using the demo you can work out which classes you need to add to your elements in order to show the loading animation you want.

By default, you will always need csspinner.

Then there are;

  • traditional
  • duo
  • double-up
  • sphere
  • sphere-vertical
  • bar
  • bar-follow
  • line
  • line grow
  • line back-and-forth
  • shadow
  • shadow oval/shadow oval left
  • shadow oval right
  • ringed
  • blade
  • helicopter

There is also no-overlay which will hide the overlay which is added by default.

Tweaking/Developing

I am fully aware that my styling of these animations aren't to everyones tastes and also that sometimes positioning won't be suitable etc. therefore it is likely you'll have to tweak the stylesheet to get the colors you want etc. I have provided both LESS and SCSS versions. There is also an older style SASS syntax file available but it does not benefit from modularity and will need to be built using ruby.

Modularity, custom builds and gulp.js

I have recently re-implemented (cs)spinner to make use of gulp.js.

In order to use the tasks I've put in place it is presumed you will already have npm and gulp installed.

Then you need to clone the repo

git clone https://github.com/jh3y/-cs-spinner

And then run

npm install

This makes it easier to run custom builds of (cs)spinner. You simply modify the spinner-config.json file setting different spins to either true or false and then run the gulp task for your chosen extension language.

The available tasks are

  • gulp less:build - will build (cs)spinner using less source files.
  • gulp scss:build - will build (cs)spinner using scss source files.
  • gulp cleanup - will clean out the build directory.
  • gulp dev - will set up a static server with livereload at localhost:1987. This particular task makes use of src/jade/index.jade to output a sandbox demo to develop against.
  • gulp - the default task will execute a cleanup followed by a less build.

You can of course tweak the gulpfile to your own needs.

How does this work?

Not surprisingly it's real simple! :)

(cs)spinner makes use of CSS pseudo elements. It uses :before to provide an overlay effect if required and :after to show the animated spinner/bar etc.

making use of pseudo elements means that we can add (cs)spinner loading animations to any existing element on our page without being intrusive just by adding some classes as long as the elements pseudo elements aren't currently in use.

Contributing

Any suggestions, improvements or issues are welcome. :)

@jh3y

License

MIT

Copyright (c) 2014 @jh3y

-cs-spinner's People

Contributors

jh3y avatar

Watchers

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