GithubHelp home page GithubHelp logo

bshiroya / spinkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tobiasahlin/spinkit

0.0 2.0 0.0 1017 KB

A collection of loading indicators animated with CSS

Home Page: http://tobiasahlin.com/spinkit/

License: MIT License

CSS 95.90% JavaScript 4.10%

spinkit's Introduction

Simple loading spinners animated with CSS. See demo. SpinKit uses hardware accelerated (translate and opacity) CSS animations to create smooth and easily customizable animations.

Usage

Regular CSS

Grab the HTML and CSS for a spinner from the example files, or add SpinKit directly to your project with bower:

$ bower install spinkit

or npm:

$ npm install spinkit

SCSS

If you're using SCSS you can include specific spinners (rather than all of them) by importing them one by one:

@import '../bower_components/spinkit/scss/spinners/1-rotating-plane',
        '../bower_components/spinkit/scss/spinners/3-wave';

You currently need to use an autoprefixer if you want to support all browsers. If you're compiling your SCSS with gulp you can use gulp-autoprefixer, and grunt-autoprefixer if you use grunt.

Variables that can be overridden are listed in scss/_variables.scss.

Web browser compatibility

CSS animations are supported in the latest version of all major browsers, and browsers with animation support make up almost 90% of all usage. If you need to support IE9 and below, however, this section is for you.

Implementing a fallback spinner

How do you know if you need to provide a fallback? You can easily check for animation support with Modernizr, or manually check for the animation property, and replace the spinner with a GIF if it's not supported:

function browserSupportsCSSProperty(propertyName) {
  var elm = document.createElement('div');
  propertyName = propertyName.toLowerCase();

  if (elm.style[propertyName] != undefined)
    return true;

  var propertyNameCapital = propertyName.charAt(0).toUpperCase() + propertyName.substr(1),
    domPrefixes = 'Webkit Moz ms O'.split(' ');

  for (var i = 0; i < domPrefixes.length; i++) {
    if (elm.style[domPrefixes[i] + propertyNameCapital] != undefined)
      return true;
  }

  return false;
}

Use it to check for animation support:

if (!browserSupportsCSSProperty('animation')) {
  // fallback…
}

Contributing

See CONTRIBUTING.md for details.

spinkit's People

Contributors

tobiasahlin avatar jacobsvante avatar zhanglun avatar ahmadhania avatar chris--jones avatar chris-rock avatar fidelix avatar jarnoux avatar coffee-cup avatar kkirsche avatar mhm5000 avatar fylax avatar patrickjs avatar pkuczynski avatar teobais avatar

Watchers

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