Skip to content

Commit

Permalink
Register MSPointer events on document to enable them on Windows Phone 8
Browse files Browse the repository at this point in the history
  • Loading branch information
madrobby committed Sep 15, 2013
1 parent 716b2ac commit 74ca007
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@

$(document).ready(function(){
var now, delta
$(document.body)

$(document)
.bind('MSGestureEnd', function(e){
var swipe_dir = e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null;
if (swipe_dir) {
Expand Down
2 changes: 1 addition & 1 deletion test/touch.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<script src="../src/polyfill.js"></script>
<script src="../src/zepto.js"></script>
<script src="../src/event.js"></script>
<script src="../src/touch.js"></script>
<script src="../src/ie.js"></script>
<script src="../src/touch.js"></script>
</head>
<body>
<h1>Touch tests</h1>
Expand Down
11 changes: 10 additions & 1 deletion test/touch_functional.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@
<head>
<meta charset="utf-8">
<title>Zepto touch functional test</title>
<meta http-equiv="x-ua-compatible" content="IE=edge">
<meta name="viewport" content="maximum-scale=1,initial-scale=1,user-scalable=0">
<script src="../src/polyfill.js"></script>
<script src="../src/zepto.js"></script>
<script src="../src/event.js"></script>
<script src="../src/touch.js"></script>
<script src="../src/ie.js"></script>
<script src="../src/touch.js"></script>
</head>
<body>
<h1>Zepto touch functional test</h1>

<p>
Browser supports touch events?
<script>document.write('ontouchstart' in window)</script><br>

Browser supports MS pointer events?
<script>document.write(!!navigator.msPointerEnabled)</script>
</p>

<div id="touch_test" style="width: 200px; height: 200px; background: #cce; -webkit-user-select: none">
touch events test
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/touchcancel_functional.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<script src="../src/polyfill.js"></script>
<script src="../src/zepto.js"></script>
<script src="../src/event.js"></script>
<script src="../src/touch.js"></script>
<script src="../src/ie.js"></script>
<script src="../src/touch.js"></script>
</head>
<body>
<h1>Zepto touch functional test</h1>
Expand Down

0 comments on commit 74ca007

Please sign in to comment.