forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index11css.html
56 lines (55 loc) · 1.66 KB
/
index11css.html
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
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="avalon.js"></script>
<script>
var model = avalon.define("xxx", function(vm) {
vm.percent = 0
})
var a = true
var id = setInterval(function() {
if (a) {
if (model.percent < 100) {
model.percent++
} else {
a = false
}
} else {
if (model.percent > 0) {
model.percent--
} else {
a = true
}
}
}, 100)
</script>
<style>
.hander{
width:20px;
height:20px;
position: absolute;
color:#fff;
background: #000;
}
.slider{
width:100%;
height:20px;
position: relative;
}
body{
padding:40px;
}
</style>
</head>
<body ms-controller="xxx">
<div class="slider" style="background:red;">
<div class="hander" ms-css-left="{{percent}}%" >{{percent}}</div>
<div style="background: greenyellow;height:20px" ms-css-width="{{percent}}%"></div>
</div>
<div class="slider" style="background:#d2d2d2;">
<div style="background: #2FECDC;height:20px" ms-css-width="{{100-percent}}%"></div>
</div>
</body>
</html>