-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfn.toggle.html
71 lines (68 loc) · 2.78 KB
/
fn.toggle.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>avalon.fn.toggle</title>
<script src="avalon.js"></script>
<script>
require(["mmAnimate"], function(avalon) {
avalon.define("fx", function(vm) {
vm.array = ["a", "b", "c", "d", "e"]
vm.effect = function() {
for (var i = 0, el; el = this.children[i++]; ) {
avalon(el).toggle(1500);
}
}
})
avalon.scan()
})
</script>
<style type="text/css">
#sample{
border:1px #f00 solid;
height: 45px;
}
#sample div { background:#a9ea00; margin:3px; width:80px; text-align: center;
height:40px; float:left}
</style>
</head>
<body>
<article>
<h3>avalon.fn.toggle(duration, props)</h3>
<p><span class="stress">描述:</span></p>
<p>将隐藏的元素显示出来,或将显示的元素隐藏。</p>
<p><span class="stress">参数:</span></p>
<dl>
<dt>duration</dt>
<dd>可选。Number。动画执行时间,单位为ms,默认为500ms。</dd>
<dd>可选。Function。动画结束时的回调函数</dd>
<dt>props</dt>
<dd>可选。Object。各种配置。</dd>
</dl>
<p><span class="stress">返回值:</span></p>
<p>avalon实例</p>
<p>props配置对象可以指定各种CSS属性,如width, height, color, fontSize, opacity等进行动画变化,
还支持scrollTop与scrollLeft这两个属性进行动画变化。还可以指定动画开始前的回调函数before,动画结束时的回调函数after,
动画是否进行倒退reverse....
</p>
<fieldset ><legend>例子</legend>
<pre class="brush:javascript;gutter:false;toolbar:false">
require(["mmAnimate"], function(avalon) {
avalon.define("fx", function(vm) {
vm.array = ["a", "b", "c", "d", "e"]
vm.effect = function() {
for (var i = 0, el; el = this.children[i++]; ) {
avalon(el).toggle(1500);
}
}
})
avalon.scan()
})
</pre>
<div id="sample" ms-controller="fx" ms-each="array" ms-click="effect">
<div >{{el}}</div>
</div>
</fieldset>
</article>
</body>
</html>