Here is another jQuery demo of mine which reproduces some typical effects of a TV channel, such as statics, loading, presentation and interactive menu. Feel free to use my code if you like it. This demo makes an extensive use of jQuery's deferred objects for chaining animations. Enjoy!
A long debate among Wordpress developers is essentially about the possibility of using truly object-oriented code in their themes and plugins by exploiting the latest features of PHP 5. Most developers who don't are accustomed to OOP in PHP think that OOP in Wordpress is rather difficult to accomplish and, in a certain sense, even counterproductive. But if you take a closer look at the inner structure of the Wordpress core, you'll surely notice the abundance of classes and most of the OOP features we're all used to see in other frameworks. This post is written in the hope of stimulating a renewed interest in OOP with Wordpress.
The global jQuery's function
noConflict() is useful not only to avoid conflicts with other libraries using the
$ alias, but also to include jQuery in our application's namespace by storing it in a property. Let's see how.
$() wrapper works also on objects, thus providing a quick and simple access to object's properties and methods when combined with the
bind() method. Let's see the details.
WPUtils (now in its first version) is a jQuery utility to hook into a Wordpress site. I've created this utility to help developers with attaching actions to specific Wordpress sections. For that reason, WPUtils features several helper functions that check if we're on a specific Wordpress page. Let's see the details.
One of my daily tasks as a developer is to modify the default styles which come along with a new Wordpress theme chosen by our clients. I have to say that this task is made harder and harder by some obtuse practices followed by many theme developers when it comes to CSS. I don't want to be rude because I love your work, but you should consider the fact that your styles may be changed by another developer or user, so you should code your CSS accordingly. Here are some of these bad practices that make me feel frustrated.
Yesterday evening I found a nice Wordpress theme with an interesting, cursor-driven effect on the main menu made with CSS. I decided to recreate it with the aid of jQuery in order to get the maximum benefit from its effects. Let's see the details.
With deferred objects and the powerful
pipe() method we can chain animations and run them sequentially and serially. jQuery allows us to do so through the
Deferred object's syntax. Let's see the details.
I was actually inspired by the cover flow effect found among the various folder options of Mac OS X to create this demo. Let's see the details.
CSS3 allows us to control almost every aspect of the visual layout of an element: properties such as
opacity combined with gradients and web fonts gives us a first-class control over elements. We can combine all these features to create the icons of social network. Look ma, no images!
There's a widespread tendency to consider the
value property of a text field as an attribute instead of a simple property whose value is a string. Such property cannot have a primitive
null value because the DOM specifications allow only nodes to have such a value. jQuery wraps the
value property with its method
val() and it uses the same principles. Let's see why an empty value of a text field cannot be null.
jQuery doesn't provide a method similar to
hasAttribute() to determine whether a given attribute exists in the DOM. However, we can use the
attr() method for this task. In fact, this method returns a boolean value when used with conditional statements.
Paginating a table with jQuery requires only the use of a repeated CSS class used as placeholder for our table rows. Most of all, tables must be properly marked up using
tbody. Otherwise, selecting rows becomes quite troublesome. Let's see the details.
The jQuery's deferred objects, introduced in jQuery 1.5, allow us to concatenate synchronous and asynchronous actions in a chain of actions. They can be applied to animations in order to avoid nested functions, thus increasing code readability and maintainance.
Today my smart father showed me an animation when all the letters of a word were scrambled together and wrapped within a container. Then the letters moved to the right, their container bent forward and the whole word started to appear in the correct order. An ideal challenge for jQuery!
I'd like to present here some useful jQuery snippets which I use for my daily work with this library. I hope you find them useful.