目录

hide()

功能

隐藏指定的元素。

语法

fx.hide(elm, duration, callback)

参数

范例

Example: 点击链接隐藏所有段落。

<!DOCTYPE html>
<html>

<head>
    <style>
    p {
        font-size: 150%;
        cursor: pointer;
    }
    </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>
    <p>Hello</p>
    <a href="#">Click to hide me too</a>
    <p>Here is another paragraph</p>
    <script>
    require(["skylark/query", "skylark/finder", "skylark/fx"], function(query, finder, fx) {
                fx.hide(finder.find("p:first"));
                query("a").on("click", function(event) {
                        event.preventDefault();
                        fx.hide(this);
                        });
                });
    </script>
</body>

</html>