1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
# angular-circular-navigation [](https://travis-ci.org/maxklenk/angular-circular-navigation) [](https://coveralls.io/r/maxklenk/angular-circular-navigation?branch=master)
angular-circular-navigation is a [AngularJS](https://github.com/angular/angular.js) directive, which is build on top of the Tutorial [Building a circular navigation with css transform](http://tympanus.net/codrops/2013/08/09/building-a-circular-navigation-with-css-transforms/) by [Sara Soueidan](http://sarasoueidan.com/).
## Usage [](https://gemnasium.com/maxklenk/angular-circular-navigation)
You can get it from [Bower](http://bower.io/):
```sh
bower install angular-circular-navigation
```
Add everything to your index.html:
```html
<link rel="stylesheet" href="bower_components/angular-circular-navigation/angular-circular-navigation.css">
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-circular-navigation/angular-circular-navigation.js"></script>
```
And specify the directive in your module dependencies:
```javascript
angular.module('myApp', ['angularCircularNavigation'])
```
Add the corresponding options in your controller:
```javascript
$scope.options = {
content: 'Menu',
isOpen: false,
toggleOnClick: true,
items: [
{
content: 'About',
onclick: function () {console.log('About');}
}
]
};
```
Then you are ready to use the directive in your view:
```html
<div ng-controller="Controller">
<circular
options="options">
</circular>
</div>
```
### Options
The following attributes define the circular navigation menu itself and how to display each item.
---
#### isOpen : boolean (default: `false`)
Shows if the items are currently displayed or not.
---
#### toggleOnClick : boolean (default: `false`)
If `true` the menu will close when an item is clicked.
---
#### background : String
Sets the css attribute `background` for the whole menu.
---
#### color : String
Sets the css attribute `color` for the whole menu.
---
#### size : String (default: `normal`)
Possible values: `small, normal, big`
---
#### button : Object
Configuration of the central button which toggles the menu.
---
##### button.content : String
The text that will be rendered in the button.
---
##### button.cssClass : String
Adds css classes to the button.
---
##### button.background : String
Sets the css attribute `background` for the button.
---
##### button.color : String
Sets the css attribute `color` for the button.
---
##### button.size : String (default: `normal`)
Possible values: `small, normal, big`
---
#### items : Array of Objects
---
##### items.content : String
The text that will be rendered in this item.
---
##### items.isActive : boolean (default: `false`)
If `true` the item is rendered more prominent.
---
##### items.onclick : function
This function will called when the item is clicked and gets the option and the item itself as attribute.
---
##### items.cssClass : String
Adds css classes to this item.
---
##### items.background : String
Sets the css attribute `background` for this item.
---
##### items.color : String
Sets the css attribute `color` for this item.
---
##### button.empty : boolean (default: `false`)
If `true` the item is not rendered.
## Development
We use Karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:
```sh
npm install -g bower grunt-cli
npm install
grunt
```
## Contributing
Please submit all pull requests the against develop branch. Make sure it passes the CI [](https://travis-ci.org/maxklenk/angular-circular-navigation) and add tests to cover your code [](https://coveralls.io/r/maxklenk/angular-circular-navigation?branch=develop). Thanks!
## Authors
**Max Klenk**
+ http://github.com/maxklenk
## Copyright and license
The MIT License
Copyright (c) 2014 Max Klenk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
|