Giter Site home page Giter Site logo

sw-spinner's Introduction

sw-spinner

Loading spinner directive for AngularJS

Installation

bower install sw-spinner --save
angular.module('myModule', ['sw-spinner']);

Directives

// Spinner element
<sw-spinner></sw-spinner>

// Additional overlay - simply block mouse events on data loading.
<sw-spinner-overlay></sw-spinner-overlay>

Events

// Start spinner (with label)
$rootScope.$broadcast(SPINNER.start, { label: 'Lorem ipsum...' });

// Stop spinner
$rootScope.$broadcast(SPINNER.stop);

Sample styles (LESS)

.spinner {
  > i {
    display: block;
    width: 24px;
    height: 24px;

    opacity: 0;

    margin: 0px auto 15px;

    font-size: 24px;
    color: #cccccc;

    transition: opacity 0.3s;

    &:before {
      display: inline-block;

      -webkit-animation: spin 2s infinite linear;
      -moz-animation: spin 2s infinite linear;
      -ms-animation: spin 2s infinite linear;
      -o-animation: spin 2s infinite linear;
      animation: spin 2s infinite linear;
    }
  }

  > label {
    display: block;

    opacity: 0;

    font-size: 10px;
    font-weight: normal;
    color: #666666;
    text-align: center;

    transition: opacity 0.3s;
  }

  &.spin {
    > i {
      opacity: 1;
    }

    > label {
      opacity: 1;
    }
  }
}

.spinner-overlay {
  display: none;

  position: fixed;
  top: 0px;
  right: 0px;
  bottom: 0px;
  left: 0px;
  z-index: 9999;

  &.visible {
    display: block;
  }
}

@-moz-keyframes spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
    from {transform:rotate(0deg);}
    to {transform:rotate(360deg);}
}

sw-spinner's People

Contributors

jakubburkiewicz avatar

Stargazers

 avatar

Watchers

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