Skip to content

Commit ecf31c0

Browse files
committed
Merge pull request #3 from ShiftyAxel/slideable
AnimatedToggleButton Modifications
2 parents e07c5c8 + d092ab8 commit ecf31c0

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

v2/AnimatedToggleButton/AnimatedToggleButton.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
}
1414

1515
.onyx-toggle-button.onyx-animated-toggle-button .onyx-toggle-content.off {
16-
margin-left: 30px;
16+
position:absolute;
17+
left:24px;
1718
}
1819

1920
.onyx-toggle-button.onyx-animated-toggle-button .onyx-toggle-content.on {
20-
margin-right: 30px;
21+
position:absolute;
22+
right:24px;
2123
}

v2/AnimatedToggleButton/AnimatedToggleButton.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ enyo.kind({
55
name: "onyx.custom.AnimatedToggleButton",
66
kind: "onyx.ToggleButton",
77
classes: "onyx-animated-toggle-button",
8+
style: "overflow:hidden;",
89
components: [
9-
{name: "contentOn", classes: "onyx-toggle-content on"},
10-
{name: "contentOff", classes: "onyx-toggle-content off"},
11-
{kind: "onyx.Slideable", name: "knob", axis: "h", unit: "px", max: 30, min: 0, overMoving: false,
12-
classes: "onyx-toggle-button-knob", ondragfinish: "tap"}
10+
{kind: "enyo.Slideable", name: "knob", axis: "h", unit: "px", max: 30, min: 0, overMoving: false,
11+
classes: "onyx-toggle-button-knob", ondragfinish: "tap", components:[
12+
{name: "contentOn", classes: "onyx-toggle-content on"},
13+
{name: "contentOff", classes: "onyx-toggle-content off"},
14+
]}
1315
],
1416
valueChanged: function() {
15-
this.inherited(arguments);
17+
this.addRemoveClass("off", !this.value);
1618
this.calculateSlidingBounds();
1719
if (this.value) {
1820
this.$.knob.animateToMax();

v2/AnimatedToggleButton/example.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
66
<script src="../enyojs/enyo/enyo.js" type="text/javascript"></script>
77
<script src="../enyojs/lib/onyx/package.js" type="text/javascript"></script>
8+
<script src="../enyojs/lib/layout/package.js" type="text/javascript"></script>
89
<script src="package.js"></script>
910

1011
<style>

0 commit comments

Comments
 (0)