的Windows Phone 8支持触控 [英] Windows phone 8 touch support

查看:156
本文介绍了的Windows Phone 8支持触控的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否的Windows Phone 8的默认浏览器中完全支持触摸事件?

Does windows phone 8 fully support touch events within the default browser?

它的工作开箱即用,使任意touchmove事件可以通过网页进行检测?

Does it work out of the box so that arbitrary touchmove events can be detected by a web-page?

我曾与一些浏览器有劫持事件touchmove用于其作为滑动手势界面的问题。是否的Windows Phone 8浏览器做类似的东西?

I have had issues with some browsers which hijack the touchmove events to use for their interface as a swipe gesture. Does windows phone 8 browser do anything like that?

任何人都可以点到有关Windows 8手机的触摸事件的任何文档?

Can anyone point to any documentation about windows phone 8 touch events?

编辑:

这里有一个网页,将允许有人用WONDOWS电话机8来测试触摸功能:<一href=\"http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx\">http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx

There is a page here that would allow someone with a wondows phone 8 to test the touch capabilities: http://blogs.msdn.com/b/ie/archive/2011/10/19/handling-multi-touch-and-mouse-input-in-all-browsers.aspx

我将不胜AP preciate如果有人可以尝试一下,让我知道,如果它工作或没有。

I would greatly appreciate if someone could try it out and let me know if it works or not.

不过,也有一对夫妇的意见...

However, there are a couple of comments...

SnarkMaiden 2011 10月20日上午11点17#只是出于好奇;我有一个平板电脑
  PC用电子笔和触控 - 在IE9中,用钢笔我可以在画
  场,但与我的手指,我只能滚动页面。是预期
  行为?特德·约翰逊[MSFT] 2011年10月20日上午11:28#

SnarkMaiden 20 Oct 2011 11:17 AM # Just for curiosity; I have a tablet PC with both pen and touch - in IE9, with the pen I can draw in the field but with my finger I can only scroll the page. Is that expected behaviour? Ted Johnson [MSFT] 20 Oct 2011 11:28 AM #

@SnarkMaiden:不幸的是,是的,那是在IE9的预期行为
  和文档模式9 IE10。 IE9还没有办法覆盖默认
  平移姿态。 IE10的10人模式下有一个新的CSS属性,
  -ms-内容缩放:无禁用平移和缩放的
  目标元素。顺便说一句,这个博客在IE10文档模式9运行。所以
  即使IE10用户通过触摸也看到此行为。

@SnarkMaiden: Unfortunately, yes, that's the expected behavior in IE9 and document mode 9 in IE10. IE9 has no way to override the default panning gesture. IE10's 10 mode has a new CSS property, "-ms-content-zooming: none" that disables panning and zooming on the target element. BTW, this blog runs in document mode 9 in IE10. So even IE10 users with touch are also seeing this behavior.

所以仍然可能无法正常工作,形成该网页,即使它是可能的设备上。

So still might not work form that page, even if it is possible on the device.

推荐答案

您应该看看这里:<一href=\"http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10.aspx#step4\">Updating触摸和指针事件(官方的Windows Phone开发者博客文章)。

You should take a look at here: Updating touch and pointer events (official Windows Phone developer blog post).

的WebKit和Internet Explorer 10处理触摸事件的处理有所不同。 WebKit的支持触摸界面,可从鼠标操作分开; IE10组触摸,鼠标和手写笔成一个单一的接口(指针)。指针事件模型也已经在指针事件工作组在提交给W3C标准化。虽然他们是不同的,该机型大致相同,所以对于指针事件的支持通常可以用最少的code的变化来添加。

WebKit and Internet Explorer 10 handle touch event handling differently. WebKit supports a touch interface that is separate from mouse handling; IE10 groups touch, mouse, and stylus into a single interface (pointer). The pointer event model also has been submitted to the W3C for standardization under the Pointer Events Working Group. Although they are different, the models are generally similar, so support for pointer events can generally be added with minimal code changes.

指针API使用标准下,移动事件模型。因此,它是简单的挂钩听众现有的事件处理程序的指针事件。

The pointer API uses a standard "down, move, up" event model. Therefore, it’s simple to hook up listeners for existing event handlers to pointer events.

this.element.addEventListener("touchstart", eventHandlerName, false); 
this.element.addEventListener("touchmove", eventHandlerName, false);
this.element.addEventListener("touchend", eventHandlerName, false);

if (window.navigator.msPointerEnabled) {
  this.element.addEventListener("MSPointerDown", eventHandlerName, false);
  this.element.addEventListener("MSPointerMove", eventHandlerName, false);
  this.element.addEventListener("MSPointerUp", eventHandlerName, false);
}
this.element.addEventListener("touchstart", eventHandlerName, false);
this.element.addEventListener("touchmove", eventHandlerName, false);
this.element.addEventListener("touchend", eventHandlerName, false);

关闭默认触摸行为

在Internet Explorer 10的指针事件模型要求你明确地指出哪个页面地区将有自定义手势操作(使用code刚刚添加),以及将使用默认手势操作(平移页) 。您可以通过在应该退出默认手势使用-ms触摸动作财产处理的元素添加标记做到这一点。例如:

Turning off default touch behavior

The pointer event model in Internet Explorer 10 requires you to explicitly indicate which areas of the page will have custom gesture handling (using the code you just added), and which will use default gesture handling (pan the page). You can do this by adding markup on elements that should opt out of default gesture handling using the -ms-touch-action property. For example:

<div id="slider" style="overflow: hidden;">

<div id="slider" style="overflow: hidden; -ms-touch-action: none;">

除了无,IE10在Windows Phone 8还支持泛x和泛y属性,用于指定浏览器应处理水平或垂直手势,以及自定义JavaScript处理程序应该处理一切。

In addition to none, IE10 on Windows Phone 8 also supports the pan-x and pan-y properties, which specify that the browser should handle horizontal or vertical gestures, and custom JavaScript handlers should handle everything else.

这篇关于的Windows Phone 8支持触控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆