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
NTU CCSP 2012Fall - Mobile Web入門 回首網頁開發
Search
Steven Su
December 12, 2012
Programming
320
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NTU CCSP 2012Fall - Mobile Web入門 回首網頁開發
Steven Su
December 12, 2012
More Decks by Steven Su
See All by Steven Su
JSDC.TW 2013 Node.js佈署心得
xpsteven
14
1.2k
NTU CCSP 2012Fall - Facebook
xpsteven
1
220
NTU CCSP 2012Fall - Node.js #2.1 - Simple File Host Service
xpsteven
2
460
NTU CCSP 2012Fall - Node.js #3 - Mongoose
xpsteven
2
740
NTU CCSP 2012Fall - Node.js #2 - express.js
xpsteven
3
580
Y! Open Hack 2012 Taiwan
xpsteven
0
200
NTU CCSP 2012Fall - Node.js #2 - Advanced Javascript and Node.js
xpsteven
1
560
Other Decks in Programming
See All in Programming
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
5.1k
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
640
Inside Stream API
skrb
1
720
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
120
AI時代のUIはどこへ行く?その2!
yusukebe
21
7.2k
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
340
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
340
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
690
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
180
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
How STYLIGHT went responsive
nonsquared
100
6.2k
Writing Fast Ruby
sferik
630
63k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
320
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
390
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
WCS-LA-2024
lcolladotor
0
640
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Transcript
Mobile Web入門 回首網頁開發 NTU CCSP 2012Fall
• mobile device普及的時候,針對 mobile最佳化的網頁還不多,所以有 viewport的設計。 • viewport:rendering engine認為的畫 面大小。 •
在desktop,viewport大小同browser 大小。 • 為了讓mobile device可以瀏覽一般 網頁,另為導入scale機制。 #1 a pixel is not a pixel
mobile最佳化 • <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0, minimum-scale=1.0"> •
把上面這行加到head裡 • width=device-width ◦ viewport寬度同裝置寬度 • initial-scale=1.0, user-scalable=no, maximum-scale=1.0, minimum- scale=1.0 ◦ 完全鎖死放大與縮小 ◦ 缺一不可 • viewport metadata在desktop是無用的
#2 scrollbar • 再見,難看的scrollbar。 • http://css-tricks.com/custom-scrollbars-in-webkit/ • webkit only QQ
::-webkit-scrollbar { width: 12px; } ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); border-radius: 10px; } ::-webkit-scrollbar-thumb { border-radius: 10px; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); } ::-webkit-scrollbar-thumb { background: #999; }
#3 更多 • 捲動阻尼與動能 ◦ * {-webkit-overflow-scrolling: touch;} • 移除按鈕顏色
◦ * {-webkit-tap-highlight-color:rgba(0,0,0,0);} •
what is webkit • Safari的核心 所以是蘋果公司的 但開放原始碼 ◦ 其實apple對open source也是有貢獻的
◦ 包含著名的LLVM專案 • 網頁排版/渲染引擎+JS引擎 ◦ 動態網頁技術讓兩者越來越密不可分 • 源自開源桌面系統KDE • Chrome也是webkit-based但改用買來的V8 engine
#4 js scroller • native scroller ◦ 不需要js ◦ 比較侷限
• js scoller ◦ 用大廠牌的就對了 ◦ https://github.com/zynga/scroller ◦ Demo ▪ http://zynga.github.com/scroller/demo/easyscroller.html ▪ http://zynga.github.com/scroller/demo/dom-snapping.html
#5 touchstart • click和touch傻傻分不清楚 • webkit-based導入300ms的點擊延遲 • 只對按鈕使用touchstart事件 • $('body').on('touchstart
click', 'a', function(e){...}); • 或使用套件 https://github.com/ftlabs/fastclick
#6 position: fixed • mobile web在去年對position: fixed的支援度還不高 • 目前算是相對健全了 http://caniuse.com/
#7 transform/transition很吃資源 • http://csc-studio.tumblr.com/post/25840306358 • 啟用3D加速 • 原則:不要為了特效而特效 • 比起沒有特效
使用者更討厭讀取慢和crash *{ -webkit-backface-visibility: hidden; -webkit-perspective: 0; -webkit-transform-style: preserve-3d; -webkit-transform: translate3d(0,0,0) rotate(0) scale(1); }
#8 APP包WEB? • 俗稱WebView-Based App • 框架 ◦ PhoneGap ◦
Sencha Touch ◦ jQuery mobile • 優點 ◦ 讓Web開發人員可以開發App • 缺點 ◦ write once debug everywhere ◦ webview和mobile web browser的效能有差
#9 即使是chrome... • 雖然chrome的開發者工具可以調整user-agent和視窗大小 • 但沒有真的在mobile browser上跑過 是不能知道bug的.... • 例如
◦ 位置transition有機率破壞touchstart事件的觸發 ◦ fixed+transition也會破壞touchstart事件的觸發 ◦ 可能是瀏覽器內和在動畫結束後沒有重新計算事件觸發的區域
#10 不只要會用套件 • 更要能改套件與看懂套件的code • 例如bootstrap的dropdown不能正確收闔的bug ◦ https://github.com/twitter/bootstrap/issues/5094
#11 media query /* Large desktop */ @media (min-width: 1200px)
{ ... } /* Portrait tablet to landscape and desktop */ @media (min-width: 768px) and (max-width: 979px) { ... } /* Landscape phone to portrait tablet */ @media (max-width: 767px) { ... } /* Landscape phones and down */ @media (max-width: 480px) { ... } • 幾個重要的值 ◦ 1024px landscape ipad ◦ 768px portrait ipad ◦ 480px landscape iphone ◦ 320px portrait iphone
#12 media query的小問題 • 前面有提到桌面瀏覽器不能鎖死viewport • Ctrl+與Ctrl-會調整CSS pixel • 最好的CSS單位其實是em
但很難用.... • 結法 ◦ 盡量避免overflow: hidden
#13 Responsive Web Design • RWD ◦ 相對減少人力需求 ◦ 較難最佳化
▪ 最佳化過頭不就變成SD • Specific Design ◦ 最佳化顯示 ◦ 需要較多人月 ◦ stackoverflow.com
#14 Real-Time Web var io = require('socket.io').listen(80); io.sockets.on('connection', function (socket)
{ socket.emit('news', { hello: 'world' }); socket.on('my other event', function (data) { console.log(data); }); }); /////////////////////////////////////////////////////////////////////////////////////////////////////////// <script src="/socket.io/socket.io.js"></script> <script> var socket = io.connect('http://localhost'); socket.on('news', function (data) { console.log(data); socket.emit('my other event', { my: 'data' }); }); </script>
#15 WebGL • https://turbulenz.com/ • three.js https://github.com/mrdoob/three.js/ • desktop browser除了IE都ready了
◦ MS覺得安全性有問題?! • mobile borwser都還沒 哭哭 • 有可能大幅改變遊戲生態系
#16 Audio • Audio tag ◦ iOS需要使用者觸發 • Audio API
◦ 不建議使用
#17 WebRTC • http://updates.html5rocks.com/2012/12/WebRTC-hits-Firefox-Android-and- iOS • Android/iOS/Chrome/Firefox Ready • http://www.webrtc.org
• Google主推 • UDP-based => 較好的防火牆穿透 • 應用 ◦ P2P ◦ 即時視訊
#18 Stream API • http://www.html5rocks.com/en/tutorials/getusermedia/intro/
QA時間