-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfn.hide.html
79 lines (76 loc) · 3.25 KB
/
fn.hide.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
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>avalon.fn.hide</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++]; ) {
if (avalon.isHidden(el)) {
avalon(el).show(1500);
} else {
avalon(el).hide(1000);
}
}
}
})
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.hide(duration, props)</h3>
<p><span class="stress">描述:</span></p>
<p>用一种优雅方式隐藏匹配的元素。它分别对元素高宽以及所有内外边距,边框与透明度变零,一旦完成后将display设为none,然后还原刚才的CSS属性。</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++]; ) {
if (avalon.isHidden(el)) {
avalon(el).show(1500);
} else {
avalon(el).hide(1000);
}
}
}
})
avalon.scan()
})
</pre>
<div id="sample" ms-controller="fx" ms-each="array" ms-click="effect">
<div >{{el}}</div>
</div>
</fieldset>
</article>
</body>
</html>