I have a lot of JavaScript on my page and I use typekit. In order for my page to work correctly (grid and stuff), I use new font events like kit.
This is just a try and catch statement that checks if the fonts are loading or not. However, for some reason I do not understand. I call a function setGrid()if fonts such as kit are loaded, but, for example, the iPad or iPhone do not yet support, and therefore my page does not display correctly if I do not call the function setGrid().
In any case, I also want to call the function in the error statement, so if the page is called on the iPhone, the page works without websites.
try {
Typekit.load({
loading: function() { },
active: function() { setGrid(); },
inactive: function() { }
})
} catch(e) {
alert('error');
setGrid();
}
However, the function alertworks, the function is setGrid()not called. Any ideas?
edit: the function looks like this:
var setGrid = function () {
$('#header, #footer').fadeIn(500);
return $("#grid").vgrid({
easeing: "easeOutQuint",
time: 800,
delay: 60
});
};