$.sortGrid() Download jquery.sortGrid.js

Parameters:

$('#someElement').sortGrid({1}, {2}, {3});

  1. Name of class to sort by
  2. Timeout in milliseconds to run animation
  3. Callback Function

Example:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Clicking on one of the navigation links will sort the boxes based on the corresponding class name.
Back to Article

Code:

 
jQuery(function($){
 		
    $(".nav li a").live("click", function(e){
        e.preventDefault();
        var el = $(this);
        if(!el.parent().hasClass("active")){
            el.parent().addClass("active").siblings().removeClass("active");
            
            $(".boxes").sortGrid(el.attr("rel"), 1000);
            
        }
    });
                    
});