目录

scrollToTop()

功能

通过动画它的滚动条来滚动指定元素的内容。

语法

fx.scrollToTop(elm, pos, duration, callback) 

参数

范例

Example: 开始搜索段落所有后代的span元素。

<!DOCTYPE html>
<html>

<head>
    <style>
    body {
        font-size: 16px;
        font-weight: bolder;
    }

    p {
        margin: 5px 0;
    }
    </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><span>Hello</span>, how are you?</p>
    <p>Me? I'm <span>good</span>.</p>
    <script>
    require(["skylark/styler", "skylark/finder"], function(styler, finder) {
        finder.findAll("span").forEach(function(node) {
            styler.css(node, "color", "blue");
        });
    });
    </script>
</body>

</html>