Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

136 lines (123 sloc) 3.793 kb
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0" />
<title>jQueryTouch test page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.touch.js"></script>
</head>
<style>
body
{
-ms-content-zoom-boundary-max: 100%;
-ms-content-zoom-boundary-min: 100%;
}
#test-area
{
background-color: black;
color: white;
height: 400px;
text-align: center;
}
#last-event
{
background-color: white;
position: absolute;
top: 0;
}
#original-event
{
background-color: white;
position: absolute;
top: 0;
right: 0;
height: 300px;
overflow: hidden;
}
.string
{
color: green;
}
.number
{
color: darkorange;
}
.boolean
{
color: blue;
}
.null
{
color: magenta;
}
.key
{
color: red;
}
</style>
<body>
<div id="test-area">
Test area</div>
<div id="last-event">
<p id="last-event-name">
</p>
<pre id="last-event-detail"></pre>
</div>
<div id="original-event">
</div>
<script>
function syntaxHighlight(json) {
if (typeof json != 'string') {
json = JSON.stringify(json, undefined, 2);
}
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
} else {
cls = 'string';
}
} else if (/true|false/.test(match)) {
cls = 'boolean';
} else if (/null/.test(match)) {
cls = 'null';
}
return '<span class="' + cls + '">' + match + '</span>';
});
}
$("#test-area").touchInit();
var timeout_id = null;
var last_original_event = null;
var handler = function (e) {
$("#last-event-name").text(e.type);
var showData =
{
clientX: e.clientX,
clientY: e.clientY,
pageX: e.pageX,
pageY: e.pageY,
screenX: e.screenX,
screenY: e.screenY,
touches: e.touches
};
$("#last-event-detail").html(syntaxHighlight(JSON.stringify(showData, undefined, 2)));
if (last_original_event != e.originalType) {
last_original_event = e.originalType;
$("#original-event").html(e.originalType + "<br/>" + $("#original-event").html());
if (timeout_id !== null) window.clearTimeout(timeout_id);
timeout_id = window.setTimeout(
function () {
$("#original-event").html("");
},
5000);
}
};
$("#test-area").on("touch_start", handler);
$("#test-area").on("touch_move", handler);
$("#test-area").on("touch_end", handler);
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.