通过淡入的方式显示匹配元素。
fx.fadeIn(elm, duration, callback)
Example: 淡入所有段落,在一定时间(毫秒)完成这些动画。
<!DOCTYPE html> <html> <head> <style> span { color: red; cursor: pointer; } div { margin: 3px; width: 80px; display: none; height: 80px; float: left; } div#one { background: #f00; } </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <span id="target">Click here...</span> <div id="one"></div> <script> require(["skylark/query", "skylark/finder", "skylark/fx"], function(query, finder, fx) { query("body").on("click", function() { fx.fadeIn(finder.find("div"), "slow"); }); }); </script> </body> </html>