Category: plugins

Track user clicks on certain links

We recently added a new feature to dailystrength.org, and there was much debate about whether users would use it as we intended. To find out, I wrote a clicktrack ditty that sends some data to the server when a link is clicked. It was somewhat inspired by a post I wrote a while ago about […]

Update page using JSON data

updateWithJSON is a jQuery plugin that updates elements on your page based on key/value pairs in a JSON object. Usage:
$.updateWithJSON(jsonData)
Here’s a demo, and here’s how it works:

iterate over each property/value combination in the JSON object
look for an element in the DOM that matches the property name

first, look for an element with a matching id attribute
if […]

Determine the order of two DOM elements

Inspired by this from PHP, I wanted a utility function to determine whether a given element came before or after another element in the DOM.
 
(function($){
$.order = function($a,$b) {
 
$a = $a.eq(0);
$b = $b.eq(0);
var c = ‘order-test’;
 
$a.addClass(c);
 
[…]

Flexible plugin for nested table of contents

My partner saw the search results page for this blog and, always on the lookout for a way to improve things, suggested that it would benefit from a table of contents at the top. I could do this with Wordpress, of course, but it sounded like a good idea for a jQuery plugin, too.
A […]

Anchor-based URL navigation, Take 2

I noticed I was getting a lot of visits via Google for my post on anchor-based URL navigation with jQuery, so I decided to write a plugin that would accomplish the same thing.

Download the plugin
View a demo

Call this function on an element that contains “panels” which, in turn, contain anchors. The container element should […]

Graph data from an HTML table using jQuery and flot

I just got done with a first draft of the graphTable plugin, which lets you take a simple HTML table and turn the data in it into a graph using jQuery and flot. Here’s a demo, and here’s the jQuery plugin page where I’ll continue development if there’s any interest.
The most basic usage is simple:
 
$(’#table1′).graphTable({series: […]

jQuery: Randomly reorder children elements of selected elements

I’m working on a new template for a client, and they asked me to display some list elements in a random order on each page load. I did my Google due diligence, but didn’t come up with anything that wasn’t slideshow-like — what I wanted was just something that would show all of the children […]