Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Web App开发
Search
周祺
January 17, 2013
Programming
4
230
Web App开发
Web App开发中的各种问题
周祺
January 17, 2013
Tweet
Share
More Decks by 周祺
See All by 周祺
Mobile Web的性能优化与测试
zhouqicf
7
330
Web App
zhouqicf
1
140
f2e @ 2012
zhouqicf
6
170
Photoshop影像修饰艺术
zhouqicf
4
350
前端和视觉间的故事
zhouqicf
1
140
CSS模块化
zhouqicf
2
220
Chrome Extension
zhouqicf
1
340
Other Decks in Programming
See All in Programming
テストをしないQAエンジニアは何をしているか?
nealle
0
130
Multi Step Form, Decentralized Autonomous Organization
pumpkiinbell
1
660
Formの複雑さに立ち向かう
bmthd
1
720
CNCF Project の作者が考えている OSS の運営
utam0k
5
690
WebDriver BiDiとは何なのか
yotahada3
1
140
昭和の職場からアジャイルの世界へ
kumagoro95
1
350
Amazon S3 TablesとAmazon S3 Metadataを触ってみた / 20250201-jawsug-tochigi-s3tables-s3metadata
kasacchiful
0
100
Honoをフロントエンドで使う 3つのやり方
yusukebe
5
2.2k
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
AHC041解説
terryu16
0
590
Conform を推す - Advocating for Conform
mizoguchicoji
3
680
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
200
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
99
18k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
51k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Rails Girls Zürich Keynote
gr2m
94
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
Transcript
Web App 开发 周祺(由校)os.aliyun.com 13年3月5⽇日星期⼆二
关于我 周祺,花名:由校 云OS - 前端开发⼯工程师 -Github:zhouqicf -Weibo:@由校校校 -Blog : zhouqicf.com
-Email :
[email protected]
13年3月5⽇日星期⼆二
框架 13年3月5⽇日星期⼆二
} 13年3月5⽇日星期⼆二
适配 13年3月5⽇日星期⼆二
Responsive Web Design http://www.alistapart.com/articles/responsive-web-design/ 13年3月5⽇日星期⼆二
Responsive Web Design http://www.alistapart.com/articles/responsive-web-design/ HVGA @media screen and (max-width: 320px)
{ ... } WVGA @media screen and (max-width: 321px) and (max-width: 480px) { ... } iPad @media screen and (max-width: 481px) and (max-width: 768px) { ... } Larger @media screen and (min-width: 769px) { ... } 13年3月5⽇日星期⼆二
Responsive Web Design http://www.zhouqicf.com/html-css/resolution-adaptation-for-mobile 13年3月5⽇日星期⼆二
View Port http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html http://developer.android.com/guide/webapps/targeting.html 320px display on 640px 13年3月5⽇日星期⼆二
View Port <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> width=device-width
浏览器预设的宽度(iphone4为 320),不是设备的真实宽度 user-scalable = 0 禁⽌止⽤用户缩放 initial-scale=1.0 初始缩放,1.0即不缩放 maximum-scale=1.0 最⼤大缩放⽐比率,1.0即不可放⼤大 13年3月5⽇日星期⼆二
View Port 13年3月5⽇日星期⼆二
View Port 13年3月5⽇日星期⼆二
<meta content="width=320" name="viewport" /> View Port <meta content="initial-scale=1.5" name="viewport" />
width=320 当应⽤用为320px宽屏幕设计时,可以制定浏 览器的layout viewport也为320px,使应⽤用在 各种设备上完美显⽰示,但android不⽀支持 initial-scale=1.5 ⼀一个解决的办法是制定缩放⽐比率,⽐比如 480px的设备上缩放⽐比率为1.5 13年3月5⽇日星期⼆二
View Port 13年3月5⽇日星期⼆二
性能 13年3月5⽇日星期⼆二
http://book.douban.com/subject/3132277/ http://book.douban.com/subject/4719162/ http://book.douban.com/subject/5362856/ 传统的优化 绝⼤大多数针对桌⾯面的优化原则在mobile上同样适⽤用 13年3月5⽇日星期⼆二
ScrollView { position: fixed; overflow: scroll; } 移动设备浏览器不⽀支持这些CSS,导致需要通过脚本来实现区域滚动 13年3月5⽇日星期⼆二
ScrollView http://cubiq.org/iscroll-4 13年3月5⽇日星期⼆二
ScrollView 任何JS实现的ScrollView都存在性能问题,这是⼀一个世界难题 iScroll滚动与原⽣生滚动条滚动的对⽐比,渲染和脚本执⾏行激增 13年3月5⽇日星期⼆二
ScrollView ✦尽可能通过交互的改变,避免区域滚动 ✦减少滚动容器的DOM数和层级 ✦使滚动容器脱离标准流,如绝对定位 ✦避免对滚动元素及其⼦子元素使⽤用box-shadow等⾼高消耗的css3属性 ✦避免在滚动时做其他的操作,特别是修改DOM、样式 13年3月5⽇日星期⼆二
ScrollView Chrome 打开chrome://flags/,启⽤用“FPS 计数器” Android adb fps 50+on desktop 30+on
mobile 上⼀一⻚页的建议未必在你的应⽤用上奏效,通过查看fps返回修改代码,尝试各种⽅方案来提⾼高流畅度 13年3月5⽇日星期⼆二
即刻响应 TAP 背后同步 即刻响应⽤用户的操作,数据同步可以在背后默默进⾏行,甚⾄至保存在本地,在某⼀一时刻⼀一起同步 13年3月5⽇日星期⼆二
数据缓存 有缓存? 请求 读取缓存 请求 否 是 过期? 否 重新请求
客户端对于⾮非实时性数据可以对数据进⾏行⼀一定时间的缓存 13年3月5⽇日星期⼆二
资源缓存 有缓存? 返回包含资源的html 返回不包含资源的html 请求 否 是 读取本地资源 缓存资源到本地, 同时更新cookie
server端根据cookie判断是否需要返回资源 13年3月5⽇日星期⼆二
Debug 13年3月5⽇日星期⼆二
Chrome 13年3月5⽇日星期⼆二
Safari Remote Debug https://www.webkit.org/blog/1620/webkit-remote-debugging/ 13年3月5⽇日星期⼆二
Android Remote Debug https://developers.google.com/chrome/mobile/docs/debugging 13年3月5⽇日星期⼆二
Android ADB adb logcat :D | find “javaScript” http://developer.android.com/tools/help/adb.html 13年3月5⽇日星期⼆二
Weinre http://people.apache.org/~pmuellr/weinre/docs/latest/Home.html 13年3月5⽇日星期⼆二
Adobe Edge Inspect http://html.adobe.com/edge/inspect/ 13年3月5⽇日星期⼆二
现状 13年3月5⽇日星期⼆二
硬件份额 13年3月5⽇日星期⼆二
系统份额 13年3月5⽇日星期⼆二
http://html5test.com/results/mobile.html HTML5 Test 13年3月5⽇日星期⼆二
console.log(“ Thanks!”)
[email protected]
blog: http://zhouqicf.com weibo: @zhouqicf github: http://zhouqicf.github.com 13年3月5⽇日星期⼆二