4
我使用masonry和typekit。因此,我想由於圖像加載而在的佈局,並在同一時間render the typekit fonts without having the default fonts being shown in a flash when we first load the page。使用jQuery Masonry重疊問題和Typekit
因此,我需要javascript代碼來處理這兩個問題:正確地重疊砌體圖像和加載typekit字體。
我在我的javascript文件中加載完美的石工,但我無法正確加載typekit字體下面的代碼。當網站第一次加載時,它顯示默認的Times New Roman字體,然後顯示flash後的typekit字體。
如何修改我的javascript代碼?
//trigger masonry and typekit
var $container = $('#wrapper');
function triggerMasonry() {
if (!$container) {
return
}
$container.imagesLoaded(function(){
$container.masonry({
itemSelector : '.box',
columnWidth : 240
});
});
}
$(function(){
$container = $('#wrapper');
triggerMasonry();
});
Typekit.load({
active: triggerMasonry,
inactive: triggerMasonry
});