0

Ok, I have this slight issue, I am using JointsWP with WordPress, and also loading custom fonts from Typekit. The fonts load with a slight delay and they keep flashing on the screen when swapping with fallback (issue for another time). I am trying to use Equalizer (Documentation) to equalize the heights on two columns.

Because the fallback font is slightly smaller/lower, when TypeKit loads, the Equalizer has already loaded its heights and therefore it falls a bit short. For instance the Height without Typekit is 320px and with Typekit fonts should be 325px. I have this callback function from Typekit, that should fire after the fonts have finished loading.

try {
        Typekit.load({
            active: function() {
                console.log("test")
                var elem = new Foundation.Equalizer(element);
                elem.applyHeight();         // Foundation 6
            }
        })
} catch(e) {}

However, I get an error

Uncaught (in promise) ReferenceError: element is not defined(…)

I am not sure why that is. The script is loaded on the end of the page, after foundation javascript has already been loaded.

If anyone can clear this up for me, I would appreciate it dearly. Thank you

Svedr
  • 589
  • 2
  • 6
  • 21
  • It would help us help you if you could replicate the issue in a [fiddle](https://jsfiddle.net) – Yass Feb 20 '16 at 21:35
  • You should use [`catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) not `catch`. It's an asynchronous error. – Bergi Feb 20 '16 at 22:18
  • @Bergi thank you, that worked. I would never have figured it out myself. – Svedr Feb 21 '16 at 21:23

0 Answers0