shake

当用户摇动设备后触发

定义

当用户摇动设备后触发,前后左右在一定连续时间内以一定幅度摇动设备

示例

<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-touch-fullscreen" content="yes">
    <script src="//g.alicdn.com/kissy/k/1.4.7/seed.js" data-config="{combine:true}"></script>
</head>
<body>

<h1>open in ios and shake your phone</h1>
<script type="text/javascript">

    var S = KISSY;

    S.use('event', function (S, Event) {
        Event.on(window, 'shake', function (e) {
            alert('i know u shake !');
        });
    });

</script>

</body>
</html>