WebAPP 开发tips for iPad

一、应用启动画面设置:

页面头部加入

<link rel="apple-touch-startup-image" media="screen and (orientation: portrait)" href="/apple_startup.png">
<link rel="apple-touch-startup-image" media="screen and (orientation: landscape)" href="/apple_startup1.png">

重点在下面:

两张图片必须符合宽高标准才能正常显示:

startup_portrait.png 768x1004

startup_landscape.png 748x1024

1、要注意横屏用图必须竖过来,也就是宽748高1024才能显示,怕说不清楚做了个示意图;

2、在safari里选“添加到主屏幕”时要保证设备是竖放,才能在完成后成功显示启动画面。

 

部分措辞有调整,原文传送门

 

示例一枚

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
<meta name="apple-mobile-web-app-capable" content="yes" />  
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
<link rel="apple-touch-startup-image" media="screen and (orientation: landscape)" href="startup.png">
<link rel="apple-touch-icon" href="icon.png"/> 

 

 

二、禁止页面缩放拖动等
 

在<body>中加入

ontouchmove="event.preventDefault()" //锁定viewport,任何屏幕操作不移动用户界面(弹出键盘除外)。

 

三、一些特殊事件

 

Touchstart //当手指接触屏幕时触发
Touchmove //当已经接触屏幕的手指开始移动后触发
Touchend //当手指离开屏幕时触发
touchcancel
gesturestart //当两个手指接触屏幕时触发
gesturechange //当两个手指接触屏幕后开始移动时触发
gestureend


例如采用Touchend代替onclick,可以有效的去掉点击产生的阴影框。注意:ontouchend 不可用于 IE

 或者也可以用CSS解决阴影框

-webkit-tap-highlight-color

这个属性只用于iOS (iPhone和iPad)。当你点击一个链接或者通过Javascript定义的可点击元素的时候,它就会出现一个半透明的灰色背景。要重设这个表现,你可以设置-webkit-tap-highlight-color为任何颜色。

想要禁用这个高亮,设置颜色的alpha值为0即可。

 

 

(未完待续...by wdd 20120412)
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值