Skip to content

Commit 399ebba

Browse files
committed
Added z-index
1 parent 9c7c403 commit 399ebba

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

Gruntfile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = function(grunt) {
3939
options: {
4040
port: 9000,
4141
// Change this to '0.0.0.0' to access the server from outside.
42-
hostname: 'localhost'
42+
hostname: '0.0.0.0'
4343
},
4444
demo: {
4545
options: {
@@ -127,6 +127,7 @@ module.exports = function(grunt) {
127127
});
128128

129129
grunt.registerTask('serve', [
130+
'build',
130131
'connect:demo:keepalive'
131132
]);
132133

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ angular.module('myApp', ['stanleygu.spinners']);
1313
Invoke the directives with the desired attributes
1414
```html
1515
<spinner template="{{type}}" color="{{color}}" screen-color="{{screenColor}}" screen-opacity="{{screenOpacity}}"
16-
loading="{{loading}}"></spinner>
16+
loading="{{loading}}" z-index="200"></spinner>
1717
```
1818

1919
`template` is a string containing one of 7 different spinner types:
@@ -35,3 +35,5 @@ loading="{{loading}}"></spinner>
3535
`color` and `screen-color` are CSS color names for the spinner color and background screen color, respectively.
3636

3737
`opacity` is a number from 0-1 for the screen opacity.
38+
39+
`z-index` is the z-index of the spinner.

dist/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>Angular Spinners
2525
<img data-src="holder.js/200x300">
2626
<img data-src="holder.js/190x300">
2727
<spinner template="{{type}}" color="{{color}}" screen-color="{{screenColor}}" screen-opacity="{{opacity/100}}"
28-
loading="{{loading}}"></spinner>
28+
loading="{{loading}}" z-index="200"></spinner>
2929
</div>
3030
<div style="width:800px; margin:0 auto;">
3131
<form class="form-horizontal">

dist/spinners.js

+8-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/spinners.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/spinners.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ angular.module('stanleygu.spinners.src', [])
1010
screenOpacity: '@',
1111
color: '@',
1212
loading: '@',
13-
template: '@'
13+
template: '@',
14+
zIndex: '@'
1415
},
1516
// templateUrl: function($element, $attrs) {
1617
// var base = '/templates/';
@@ -42,15 +43,15 @@ angular.module('stanleygu.spinners.src', [])
4243
.css('position', 'absolute')
4344
.css('top', '45%')
4445
.css('left', '50%')
45-
.css('z-index', '100');
46+
.css('z-index', attr.zIndex || '100');
4647

4748
angular.element(element[0].querySelector('.spinner'))
4849
.css('position', 'relative')
4950
.css('top', '-50%')
5051
.css('left', '-50%')
5152
.css('margin', 'auto auto 0')
5253
.css('text-align', 'center')
53-
.css('z-index', '101');
54+
.css('z-index', attr.zIndex + 1 || '101');
5455

5556
var t = element.attr('template');
5657
if (t === 'pulse' || t === 'rotatePlane') {
@@ -71,7 +72,7 @@ angular.module('stanleygu.spinners.src', [])
7172
.css('right', '0')
7273
.css('bottom', '0')
7374
.css('left', '0')
74-
.css('z-index', '99');
75+
.css('z-index', attr.zIndex - 1 || '99');
7576

7677
scope.$watch('loading', function(newVal) {
7778
if (newVal === 'true' || newVal === true) {

0 commit comments

Comments
 (0)