Toggling CSS Properties with the GX JavaScript Animation Framework
(Page 1 of 4 )
In this ninth episode of the series, I provide you with some comprehensive examples that show how to toggle different properties of a sample div by using the core “gx()” method of the GX library. As with many tasks the GX JavaScript animation framework can be made to perform, toggling animations is a very simple process.
If you develop websites frequently, then you’ll surely have noticed that client-side frameworks are very popular these days. Whether you need to create clean div-based web page layouts, or simply want to polish the visual presentation of your carefully-crafted (X)HTML documents, there is probably a framework out there that will do the hard work for you without a single complaint.
Logically, this trend can also be seen in the JavaScript-based animation field. There is now a plethora of frameworks that permits developers to implement eye-catching visual effects on web pages in a simple fashion, and in a truly unobtrusive way.
Among the numerous JavaScript-driven animation frameworks available nowadays for free use, there’s one that might be especially appealing to you. It boasts a powerful set of features and a flat learning curve. Yes, as you may have guessed, I’m talking about GX, a library that will let you animate any HTML element in a snap. What’s more, if you’re a strong advocate of jQuery, then you’ll find that using GX is a breeze, as the library relies on many of the native methods bundled with jQuery for performing its “magic.”
To illustrate how useful GX can be for making web pages more dynamic, in previous articles of this series I covered the capabilities of the library for animating different properties of a simple div, either individually or simultaneously. Aside from showing how to perform these basic animations, I also discussed how to cancel, pause and resume a specific effect, thus demonstrating that the library provides users with a decent level of control over the way that animations are performed.
It’s fair to say, though, that GX has many more features that deserve a closer analysis. This includes its ability to toggle values assigned to properties of HTML elements. As this can be very convenient for simplifying the execution of more complex animations, in the next few lines I’ll be coding some easy-to-follow examples that will help you grasp the logic behind creating toggling animations.
Ready to learn the full details? Then let’s get started!
Next: Toggling the width of a div in a single step >>
More JavaScript Articles
More By Alejandro Gervasio