Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
55
rated 0 times [  61] [ 6]  / answers: 1 / hits: 25028  / 14 Years ago, sat, november 20, 2010, 12:00:00

I'm having a lot of JavaScript on my page and I'm using typekit. In order to make my page work correctly (grid and stuff) I'm using the new typekit font events.



It's simply a try and catch statement that checks if fonts get loaded or not. However somehow I'm not getting it. I'm calling the setGrid() function if typekit fonts are loaded, but e.g. iPad or iPhone doesn't support that yet and so my page doesn't get properly shown when I don't call the setGrid() function.



Anyway, I want to call the function in the error statement as well, so if the page is called on the iPhone, the page works without webfonts as well.



try {
Typekit.load({
loading: function() { },
active: function() { setGrid(); },
inactive: function() { }
})
} catch(e) {
alert('error'); //works
setGrid(); //doesn't get called
}


However, the alert works, the setGrid() function doesn't get called.
Any ideas?



edit: the function looks like that:



var setGrid = function () {
$('#header, #footer').fadeIn(500);
return $(#grid).vgrid({
easeing: easeOutQuint,
time: 800,
delay: 60
});
};

More From » jquery

 Answers
8

Try making it real function, like this:



function setGrid() {
$('#header, #footer').fadeIn(500);
return $(#grid).vgrid({
easeing: easeOutQuint,
time: 800,
delay: 60
});
};

[#94889] Thursday, November 18, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
analiseb

Total Points: 252
Total Questions: 96
Total Answers: 106

Location: Singapore
Member since Sat, Jul 25, 2020
4 Years ago
analiseb questions
;