iOS 3D Touch API使用Javascript的Web应用程序
iOS 3D Touch API using Javascript for Web App
iphone 6s有原生应用的3D触摸API。我想知道苹果是否已经为web应用程序启用了Javascript的3D触摸访问?
就像我们使用标准的触摸事件
element.addEventListener("touchstart", handleStart, false);
Safari 9支持桌面。参见Apple的WebKit DOM编程主题中的响应JavaScript强制触摸事件。
我找不到任何关于在iOS上使用Safari 9的文档。
你可以在iPhone和Mac上使用强制触摸。你可以使用JS库Pressure.js。如果你使用的是带有Force Touch触控板的iPhone 6s或新款Macbook,那么在iOS和OSX上获取Force和3D Touch值就会变得非常容易。目前只支持Safari,但希望更多的浏览器能很快支持。
语法也很简单,这里有一个例子:
Pressure.set('#element', {
start: function(){
// this is called on force start
},
end: function(){
// this is called on force end
},
startDeepPress: function(){
// this is called on "force click" / "deep press", aka once the force is greater than 0.5
},
endDeepPress: function(){
// this is called when the "force click" / "deep press" end
},
change: function(force, event){
// this is called every time there is a change in pressure
// here the 'force' variable passed in container the current pressure force
},
unsupported: function(){
// this is called once there is a touch on the element and the device or browser does not support Force or 3D touch
}
});
相关文章:
- 在Web应用程序中使用Highcharts javascript
- 在web应用程序中的新搜索中重新加载搜索结果(不带jQuery)
- Web应用程序,将成员状态更新为其他成员
- 同一文本框中的验证程序CPF e CNPJ(ASP.NET web应用程序)
- 使用Ember的Web应用程序架构.动画逻辑应该放在哪里
- 如何使用默认的网络摄像头拍摄照片并将其保存在我的c#.net web应用程序中
- c#web应用程序中的条形码打印
- 使用javascript为web应用程序自定义键盘快捷键
- 使用angularjs和node.js时的Web应用程序文件夹结构
- PhpWindows 8.1版本上的Javascript web应用程序
- 是否有任何开源web应用程序具有良好的QUnit(或JSUnit)测试用例
- Project和作为web应用程序发布的多个doGet()脚本文件——需要澄清
- 如何获取使用我们的脚本或web应用程序的网站名称
- 没有框架/DLL的VS Web应用程序项目
- 正确传输和保护用户'web应用程序的密码
- 检查Progressive web应用程序中的网络更改
- 一个Web应用程序上有两个Java脚本
- JavaScript onScroll在谷歌应用程序脚本web应用程序中不起作用
- 家谱web应用程序的“家谱”视图
- 如何更改web应用程序的语言.有没有这样的api