O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending the Google Font Loader

In the recipe we just looked at, we extended the Options class, took an option in the form of a CSV of Google fonts, and styled text using CSS. Get ready to see how even the instantiation line can be generated based on a few clicks. That way, no typos or issues with unavailable fonts can creep in and catch us off guard.

Designers, especially, love this one-time-use class method.

How to do it...

Dabble in a bit of polymorphism. When no fonts are passed during instantiation, route the flow of action to a new method that generates an interface. That interface will have a multi-select input widget that onClick updates a TEXTAREA with an instantiation code that designers can use to embed their Google web fonts.

For brevity, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required