diff --git a/README.md b/README.md index 00cc8ff..ef59a52 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ or ``` -Enhancements in 0.1.2 ---------------------- +Enhancements in 0.1.2+ +---------------------- Is now a UMD module for AMD or browser globals. Spin.js is so it is easier to use this with AMD now. diff --git a/bower.json b/bower.json index 9b809d8..d0dc22d 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-spin", - "version": "0.1.2", + "version": "0.1.3", "main": "src/angular-spin.js", "ignore": [ "**/.*", diff --git a/src/angular-spin.js b/src/angular-spin.js index c6a5eea..3561eef 100644 --- a/src/angular-spin.js +++ b/src/angular-spin.js @@ -8,11 +8,21 @@ 'use strict'; angular.module('spin.js', []) .directive('spin', function () { - var augmentOpts = function (color, opts) { - if (!opts.color) { - opts.color = color; - } - }; + var getColor = function (el) { + var color; + el = el[0]; + if (window.getComputedStyle) { + color = window.getComputedStyle(el, null).getPropertyValue('color'); + } else if (document.documentElement.currentStyle) { + color = el.currentStyle['color']; + } + return color; + }, + augmentOpts = function (color, opts) { + if (!opts.color) { + opts.color = color; + } + }; return { restrict: 'A', transclude:true, @@ -23,7 +33,7 @@ spinif: '=spinIf' }, link: function (scope, element, attrs) { - var cssColor = element.css('color'), + var cssColor = element.css('color') || getColor(element), stoped = false, hideElement = !!scope.config.hideElement, spinner;