gestures.html revision 7c04a3c82e4bf4bc10412f5d4fa24329807cb5a1
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0" />
<style>
#testNode, #testNode2 {
background-color: blue;
width:200px;
height:200px;
font-family:monospace;
font-size:7pt;
position:relative;
}
#testNode div {
white-space:nowrap;
}
background-color:red;
}
</style>
</head>
<body>
<div id="testNode"></div>
<div id="testNode2"></div>
<script>
YUI({filter:"raw", combine:false}).use("event-gestures", function(Y) {
var div = Y.Node.one("#testNode"),
div2 = Y.Node.one("#testNode2");
var flickHandler = function(e) {
};
var moveStartHandler = function(e) {
var target = e.target;
target.set("innerHTML", "");
};
var moveHandler = function(e) {
};
var moveEndHandler = function(e) {
};
var flickCfg = {
minDistance:20,
minVelocity:0.3
};
var moveStartCfg = {
minDistance: 10,
minTime: 5000,
button:0
};
var moveStartCfg2 = {
minDistance: 10,
minTime: -1, // must move at least 10 pixels
button:0
};
div.on("flick", flickHandler, flickCfg);
div.on("gesturemovestart", moveStartHandler, moveStartCfg);
div.on("gesturemove", moveHandler);
div.on("gesturemoveend", moveEndHandler);
div2.on("gesturemovestart", moveStartHandler, moveStartCfg2);
div2.on("gesturemove", moveHandler);
div2.on("gesturemoveend", moveEndHandler);
div.addClass("active");
});
</script>
</body>
</html>