Update: jQuery preloadImages Plugin

A few months ago I released a jQuery plugin for preloading images. Initially, I wanted to be able to simply select image elements on the page and preload their images before showing them, however I found that generally the images that I need to preload do not exist on the page at the point where I need to preload them. I ended up not using the $.fn.preloadImages plugin at all even though it had the most functionality baked into it. To solve this, I decided to remove the $.fn.preloadImages interface leaving just the core $.preloadImages interface. I then simplified the code and implemented deferred objects to make it easy to perform events during the process of preloading images.

[More]

This is my First Post using Blog.cfc!

I was working on my own blog software tonight when I realized that pretty much everything i wanted to do with my software had already been done with Blog.cfc. With that in mind, I decided to move to Blog.cfc and see what it is all about.

[More]

Do a barrel roll with your website!

Recently I became aware of a cool easter egg on the google search page. You can see it by going to https://www.google.com/search?q=do+a+barrel+roll. If you are too busy to click on that link, I'll explain it for you. Basically, when you search for do a barrel roll, the page will rotate. I implemented this cool effect into this blog for webkit and mozilla users; simply type "do a barrel roll" into the search box and hit enter(or click search) and the site will rotate. Below is how you can implement it on your own site using native javascript, and how you can enhance it with jQuery to get a smoother effect or add easing.

[More]

Using jQuery.when with a dynamic number of objects.

The jQuery.when method accepts a dynamic number of arguments, however, it does not accept an array of arguments. This tutorial show you how to get around that issue. The jQuery.when method accepts a dynamic number of deferred objects. If you know how many objects you are passing in, it is very easy to do so manually. However, if you have a dynamic number of objects that you need to pass in, it isn't as straight-forward.

[More]

jQuery preloadImages Plugin

Any time that you wish to animate an image or something that contains an image, you will receive an odd effect if that image isn't already loaded. The most common way around this issue is to preload your images. You could do this with native JavaScript, however, I decided to create the jQuery preloadImages plugin as a cross-browser way of preloading images using jQuery.

[More]

Add jQuery UI Styles to a Datatable

There are many table plugins out there, however, the majority of them try to add additional functionality that I simply do not need. I don't need sorting or pagination; I typically include sorting and pagination functionality through ajax or custom code. Because of this, I wrote this simple plugin that takes a datatable and adds jQuery ui styles to it. The primary purpose of the tableStyle plugin is to add jQuery UI styles to a datatable. The plugin is built using jQuery UI's Widget framework, therefore it follows the same api conventions as other jQuery UI widgets such as datepicker or dialog.

[More]

Highlighting text with jQuery

There was a request on the jQuery forum where a developer wanted to highlight a specific word within the document. To solve the user's problem, I created a plugin that made highlighting text with jQuery easy based on some code that I wrote and shared on the jQuery forums previously.

[More]

Select a random element using a jQuery Plugin

This is a very simple helper plugin that I put together. All it does is select a random element from a jQuery element array.

view plain print about
1(function($){
2    $.fn.rand = function(){
3        return this.eq(Math.floor(Math.random()*this.length));
4    };
5})(jQuery);

Getting values from the query string using JavaScript

Getting values from the query string using JavaScript is not very straight forward. It is very easy for server-side code, however, JavaScript doesn't have any built-in methods to access these values easily. We can however access the query string as a string using the search attribute of the location object. Querystrings come in the format "?varname1=varvalue1&varname2=varvalue2&varname3=varvalue3". To convert this into a useable format, we will first remove the "?", then we will split the name/value pairs and assign them to an object.

[More]