Skip to Main Content
Web 效能優化日誌 Volume 2
book

Web 效能優化日誌 Volume 2

by Stoyan Stefanov
July 2013
Intermediate to advanced content levelIntermediate to advanced
240 pages
4h 11m
Chinese
GoTop Information, Inc.
Content preview from Web 效能優化日誌 Volume 2
200
   
第三十三章
WebFont loader 也有
fontactive
fontloading
fontinactive
callbacks,它們會在每
次字型更新時被觸發,讓你能夠在字型層級進行控制。更多資訊,請查閱 WebFont Loader
的說明文件(https://developers.google.com/webfonts/docs/webfont_loader)。
Boot.getFont 簡介:一個快速又小型的 Web 字型載入器
我沒有看到其他的,所以我自己寫了一個小型的字型載入器(font loader),它也提供用
來載入字型的 hooks,我把它叫做
getFont
,並包含在我的 Boot 程式庫中(https://github.
com/artzstudio/Boot)。
經過 GZIP 壓縮後它的大小是 1.4 K(相較於 Google 6.4 KB,以及 Typekit 8.3
KB),而且能夠輕易地整合到你現有的程式庫中,單純只要修改該檔案結尾的
"Boot"
串,更新為你需要的命名空間(例如
jQuery
)。
字型是透過一個 JavaScript 函式來載入的,而你能夠提供一個 callback,在字型描繪
render)完成後執行。
Boot.getFont("opensans", function(){
// 字型 active 後要執行的 JavaScript
});
Boot.getFont
提供類似 Web ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

建構Android應用程式--使用HTML、CSS和JavaScript 第二版

建構Android應用程式--使用HTML、CSS和JavaScript 第二版

Jonathan Stark, Brian Jepson
高性能Spark

高性能Spark

Holden Karau, Rachel Warren
Python机器学习案例精解

Python机器学习案例精解

Posts & Telecom Press, Yuxi (Hayden) Liu

Publisher Resources

ISBN: 9789862768587