Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
angular-ui-switch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Custom Issue Tracker
Custom Issue Tracker
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angularjs
angular-ui-switch
Commits
f7542ab1
Commit
f7542ab1
authored
Aug 03, 2018
by
bingchuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev]version 0.1.1
parents
Pipeline
#56
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
0 deletions
+140
-0
angular-ui-switch.css
angular-ui-switch.css
+82
-0
angular-ui-switch.js
angular-ui-switch.js
+28
-0
bower.json
bower.json
+30
-0
No files found.
angular-ui-switch.css
0 → 100644
View file @
f7542ab1
span
.switch
{
background
:
#fff
;
border
:
1px
solid
#dfdfdf
;
position
:
relative
;
display
:
inline-block
;
box-sizing
:
content-box
;
overflow
:
visible
;
width
:
52px
;
height
:
30px
;
padding
:
0px
;
margin
:
0px
;
border-radius
:
20px
;
cursor
:
pointer
;
box-shadow
:
rgb
(
223
,
223
,
223
)
0px
0px
0px
0px
inset
;
transition
:
0.3s
ease-out
all
;
-webkit-transition
:
0.3s
ease-out
all
;
top
:
-1px
;
}
/*adding a wide width for larger switch text*/
.switch.wide
{
width
:
80px
;
}
.switch
small
{
background
:
#fff
;
border-radius
:
100%
;
box-shadow
:
0
1px
3px
rgba
(
0
,
0
,
0
,
0.4
);
width
:
30px
;
height
:
30px
;
position
:
absolute
;
top
:
0px
;
left
:
0px
;
transition
:
0.3s
ease-out
all
;
-webkit-transition
:
0.3s
ease-out
all
;
}
.switch.checked
{
background
:
rgb
(
100
,
189
,
99
);
border-color
:
rgb
(
100
,
189
,
99
);
}
.switch.checked
small
{
left
:
22px
;
}
/*wider switch text moves small further to the right*/
.switch.wide.checked
small
{
left
:
52px
;
}
/*styles for switch-text*/
.switch
.switch-text
{
font-family
:
Arial
,
Helvetica
,
sans-serif
;
font-size
:
13px
;
}
.switch
.off
{
display
:
block
;
position
:
absolute
;
right
:
10%
;
top
:
25%
;
z-index
:
0
;
color
:
#A9A9A9
;
}
.switch
.on
{
display
:
none
;
z-index
:
0
;
color
:
#fff
;
position
:
absolute
;
top
:
25%
;
left
:
9%
;
}
.switch.checked
.off
{
display
:
none
;
}
.switch.checked
.on
{
display
:
block
;
}
.switch.disabled
{
opacity
:
.50
;
cursor
:
not-allowed
;
}
angular-ui-switch.js
0 → 100644
View file @
f7542ab1
angular
.
module
(
'uiSwitch'
,
[])
.
directive
(
'switch'
,
function
(){
return
{
restrict
:
'AE'
,
replace
:
true
,
transclude
:
true
,
template
:
function
(
element
,
attrs
)
{
var
html
=
''
;
html
+=
'<span'
;
html
+=
' class="switch'
+
(
attrs
.
class
?
' '
+
attrs
.
class
:
''
)
+
'"'
;
html
+=
attrs
.
ngModel
?
' ng-click="'
+
attrs
.
disabled
+
' ? '
+
attrs
.
ngModel
+
' : '
+
attrs
.
ngModel
+
'=!'
+
attrs
.
ngModel
+
(
attrs
.
ngChange
?
'; '
+
attrs
.
ngChange
+
'()"'
:
'"'
)
:
''
;
html
+=
' ng-class="{ checked:'
+
attrs
.
ngModel
+
', disabled:'
+
attrs
.
disabled
+
' }"'
;
html
+=
'>'
;
html
+=
'<small></small>'
;
html
+=
'<input type="checkbox"'
;
html
+=
attrs
.
id
?
' id="'
+
attrs
.
id
+
'"'
:
''
;
html
+=
attrs
.
name
?
' name="'
+
attrs
.
name
+
'"'
:
''
;
html
+=
attrs
.
ngModel
?
' ng-model="'
+
attrs
.
ngModel
+
'"'
:
''
;
html
+=
' style="display:none" />'
;
html
+=
'<span class="switch-text">'
;
/*adding new container for switch text*/
html
+=
attrs
.
on
?
'<span class="on">'
+
attrs
.
on
+
'</span>'
:
''
;
/*switch text on value set by user in directive html markup*/
html
+=
attrs
.
off
?
'<span class="off">'
+
attrs
.
off
+
'</span>'
:
' '
;
/*switch text off value set by user in directive html markup*/
html
+=
'</span>'
;
return
html
;
}
}
});
bower.json
0 → 100644
View file @
f7542ab1
{
"name"
:
"angular-ui-switch"
,
"version"
:
"0.1.1"
,
"main"
:
[
"angular-ui-switch.js"
,
"angular-ui-switch.css"
],
"authors"
:
[
"xpeper <xpepermint@gmail.com>"
],
"description"
:
"iOS 7 style switch directive for AngularJS"
,
"keywords"
:
[
"angular"
,
"angularjs"
,
"ui"
,
"directive"
,
"switch"
,
"on"
,
"off"
,
"button"
,
"checkbox"
,
"form"
],
"license"
:
"MIT"
,
"homepage"
:
"https://github.com/xpepermint/angular-ui-switch"
,
"ignore"
:
[
"**/.*"
,
"node_modules"
,
"bower_components"
,
"test"
,
"tests"
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment