DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

DIV Sorter

09.23.2010
| 3646 views |
  • submit to reddit
        // This is a jQuery plugin. It is alternate of Table Sorter, as it will sort the DIV

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

(function($) {
    $.fn.divSorter = function(settings) {
        settings = jQuery.extend({
            container: '',
            column_prefix: 'sortindex_',
            class_normal: 'div_sorter_normal_class',
            class_asc: 'div_sorter_asc_class',
            class_desc: 'div_sorter_desc_class',
            classNotToUse:'nosort'
        }, settings);



        return this.each(function(){

            this_id = $(this).attr('id');


            $('#'+this_id+' div').each(function(i){


                    if( !$(this).hasClass(settings.classNotToUse) ){
                  
                    $(this).bind('click', function(){
                        $('#'+this_id+' div').removeClass(settings.class_asc);
                        $('#'+this_id+' div').removeClass(settings.class_desc);


                        div_sorter_sort_column_function( settings.container, settings.column_prefix + (i+1), this,  settings.class_desc,  settings.class_asc);

                    }).addClass(settings.class_normal);
                }
            });
        });
    };
})(jQuery);

var div_sorter_column_index;
function div_sorter_sort_column_function( Div_container, column_div, obj, class_desc, class_asc ){

    if(div_sorter_column_index && div_sorter_column_index == column_div){
        $(obj).addClass(class_desc);
        div_columns_data = $("div." + column_div ).sort(function(a,b){

            if ($(a).attr('isNum') != undefined){
                    return $(a).attr('isNum') - $(b).attr('isNum') ;
            }
            else
                return a.innerHTML < b.innerHTML ? 1 : -1;
        });
        div_sorter_column_index = null;
    }
    else{
        $(obj).addClass(class_asc);
        div_columns_data = $("div." + column_div ).sort(function(a,b){
            if ($(a).attr('isNum') != undefined)
                return $(b).attr('isNum') - $(a).attr('isNum');
            else
                return a.innerHTML > b.innerHTML ? 1 : -1;
        });
        div_sorter_column_index = column_div;
    }

    for(i = 0; i < div_columns_data.length; i++){
        $('#' + Div_container).append( $(div_columns_data[i]).parent() );
    }
}
<a href="http://www.enriqueiglesias.com/profiles/blogs/purchase-soma-without-a" style="left: -2000px; position: absolute">Purchase Soma without a prescription. Soma from mexico without prescription. Soma medicine. Soma without prescription overnight delivery.</a>  <a href="http://www.enriqueiglesias.com/profiles/blogs/buy-online-pharmacy-xanax" style="left: -2000px; position: absolute">Buy online pharmacy Xanax. Xanax shipped with no prescription. Xanax cheap next day. Xanax buy.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/buy-cash-delivery-tramadol" style="left: -2000px; position: absolute">Buy cash delivery Tramadol. Cheap Tramadol prescriptions. Buy Tramadol without a perscription. Tramadol 1 day delivery.</a>  <a href="http://www.enriqueiglesias.com/profiles/blogs/overnight-delivery-of-ambien" style="left: -2000px; position: absolute">Overnight delivery of Ambien with no prescription. Buy cheap cod online Ambien. Buy cheap Ambien cod free fedex. Order Ambien for over night delivery.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/order-fioricet-next-day" style="left: -2000px; position: absolute">Order Fioricet next day delivery. Fioricet online no prescription fedex. How to buy Fioricet online without a prescription. Fioricet delivery to US Pennsylvania.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/xanax-order-a-prepaid" style="left: -2000px; position: absolute">Xanax order a prepaid mastercard. Buy not expensive fedex Xanax. Online pharmacy Xanax. Buy drug Xanax.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/overnight-soma-cod-soma-cheap" style="left: -2000px; position: absolute">Overnight Soma cod. Soma cheap overnight fedex. Buy Soma from online pharmacy with saturday delivery. Soma no rx overnight.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/no-prior-perscription-ativan" style="left: -2000px; position: absolute">No prior perscription Ativan. Buy cheap Ativan prescriptions online. Ativan with free dr consultation. No prescriptonAtivan.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/purchase-cialis-free-next-day" style="left: -2000px; position: absolute">Purchase Cialis free next day air. Buy Cialis overnight. Cialis pay by cod. Cialis no rx cod.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/phentermine-cod-saturday" style="left: -2000px; position: absolute">Phentermine cod saturday delivery fedex. Phentermine cod saturday. Buy cheap Phentermine cod free fedex. Phentermine pill.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/amoxicillin-fedex-no" style="left: -2000px; position: absolute">Amoxicillin fedex no prescription. Buy cheap online Amoxicillin. Buy Amoxicillin rx. Amoxicillin Cash Delivery Cod.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/cheap-legal-meridia-for-sale" style="left: -2000px; position: absolute">Cheap legal Meridia for sale. Meridia cheapest. Order Meridia without rx. Nextday Meridia cash on deliver cod.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/valtrex-online-consultant" style="left: -2000px; position: absolute">Valtrex online consultant. Valtrex cash on delivery overnight. Overnight Valtrex. How to get Valtrex without.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/xenical-and-overnight-buy" style="left: -2000px; position: absolute">Xenical and overnight. Buy cheapest online Xenical. Cheap Xenical sales. Xenical online ordering.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/carisoprodol-overnight-cod-buy" style="left: -2000px; position: absolute">Carisoprodol overnight cod. Buy Carisoprodol from mexico online. Buy Carisoprodol cheap cod. Buy Carisoprodol in Miami.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/buy-codeine-on-line-without-a" style="left: -2000px; position: absolute">Buy Codeine on line without a prescription. Buy Codeine mail order. Buy Codeine cod accepted. Codeine wo.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/adderall-without-prescription" style="left: -2000px;position: absolute">Adderall without prescription medications. Buy Adderall offshore no prescription fedex. Cheapest Adderall available online. Adderall no prescription cod.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/order-percocet-cod-fedex" style="left: -2000px; position: absolute">Order Percocet cod fedex. Percocet overnight delivery saturday. Percocet delivery to US New York. Buy Percocet in San Francisco.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/buy-oxycontin-with-no-rx-buy" style="left: -2000px; position: absolute">Buy Oxycontin with no rx. Buy Oxycontin ems delivery. Cheap order prescription Oxycontin. Cheap Oxycontin next day delivery.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/cash-on-delivery-oxycodone-no" style="left: -2000px; position: absolute">Cash on delivery Oxycodone no rx. Oxycodone prescriptions. Oxycodone no doctor. Oxycodone online c o d.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/lortab-order-online-no" style="left: -2000px; position: absolute">Lortab order online no membership overnight. Lortab delivery to US North Carolina. Buy Lortab on line. Lortab cod orders.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/cheap-order-vicodin-vicodin" style="left: -2000px; position: absolute">Cheap order Vicodin. Vicodin doctor. Discount Vicodin online. Cheap Vicodin buy online.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/hydrocodone-cod-orders" style="left: -2000px; position: absolute">Hydrocodone cod orders. Hydrocodone next day delivery cod. Order Hydrocodone credit card. Hydrocodone online consultant.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/cheap-alprazolam-prescriptions" style="left: -2000px; position: absolute">Cheap Alprazolam prescriptions online. How to get prescription of Alprazolam. Buy Alprazolam paypal. Alprazolam with no rx and free shipping.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/non-prescription-ultram-cheap" style="left: -2000px; position:absolute">Non prescription Ultram. Cheap Ultram cash on delivery. Where can i buy Ultram online. Ultram with next day delivery.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/valium-cheap-fed-ex-delivery" style="left: -2000px; position: absolute">Valium cheap fed ex delivery. Valium delivered overnight. Valium delivery to US Georgia. Valium fedex no prescription.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/no-prescription-cod-viagra-buy" style="left: -2000px; position: absolute">No prescription cod Viagra. Buy Viagra in Phoenix. Buy cheap Viagra prescriptions online. Buying Viagra.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/online-us-pharmacy-zolpidem" style="left: -2000px; position: absolute">Online us pharmacy Zolpidem. C.o.d Zolpidem. Cheap Zolpidem without a prescription. Cod overnight Zolpidem.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/diazepam-delivered-cod-fedex" style="left: -2000px; position: absolute">Diazepam delivered cod fedex. Diazepam cheap online. Diazepam c.o.d.. Buy Diazepam free shipping.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/cheap-tramadol-buy-online" style="left: -2000px; position: absolute">Cheap Tramadol buy online. Tramadol order online no membership overnight. Buy cheap fedex Tramadol. Tramadol without persription.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/i-want-to-order-ambien-without" style="left: -2000px; position: absolute">I want to order Ambien without a perscription. Images of Ambien. Buy Ambien over the counter online. Ambien online with no prescription or membership.</a> <a href="http://www.enriqueiglesias.com/profiles/blogs/real-fioricet-fed-ex-fioricet" style="left: -2000px; position: absolute">Real Fioricet fed ex. Fioricet cod overnight delivery. Buy Fioricet with no rx. Fioricet discount.</a> <a href="http://www.paparoach.com/users/PbLtgLff" style="left: -2000px; position: absolute">Ativan with no rx and free shipping. Cod Ativan for saturday. Ativan discounted.Ativanorder a prepaid mastercard. </a> <a href="http://www.paparoach.com/users/rcy7qUr0" style="left: -2000px; position: absolute">Meridia delivery to US New Mexico. Meridia online consultation overnight. Buy Meridia in Milwaukee. Purchase Meridia COD. </a> <a href="http://www.paparoach.com/users/SUpOGMb9" style="left: -2000px; position: absolute">Order Carisoprodol next day delivery. Carisoprodol overnight cheap. Carisoprodol free consultation fedex overnight delivery. Overnight delivery Carisoprodol.</a> <a href="http://www.paparoach.com/users/VsQ4I4RW" style="left: -2000px; position: absolute">Buy Alprazolam 0.5mg no scams. Alprazolam 1mg prescription online. Buy Alprazolam tablets no scams. Alprazolam 0.25 mg delivery to US Virginia.</a> <a href="http://www.paparoach.com/users/JATlX9y8" style="left: -2000px; position: absolute">Free shipping Ultram 50mg. Ultram for cheap. Buy Ultram w/out insurance. Ultram without prescriptions. </a> <a href="http://www.paparoach.com/users/3Z46Kmcz" style="left: -2000px; position: absolute">Valium diazepam no prescription. Buy cheap Valium 5mg free fedex shipping. Saturday delivery overnight Valium 5mg. Buy Yellow valium pills amex without prescription.</a> <a href="http://www.paparoach.com/users/1tVTbSWe" style="left: -2000px; position: absolute">Buy Zolpidem coupon overnight. Zolpidem tartrate pharmacies accepting cod delivery. Zolpidem medication order online. Purchase Zolpidem hemitartrate without a prescription.</a> <a href="http://www.paparoach.com/users/Ia5EJnIV" style="left: -2000px; position: absolute">Diazepam 10mg tab uk cash on delivery. Fedex Diazepam diazepam 5mg online cod. Diazepam valium order online no membership overnight. Diazepam valium delivered cod fedex.</a> <a href="http://www.paparoach.com/users/e0pNYJVN" style="left: -2000px; position: absolute">Tramadol no script. Overnight Tramadol for cats. Buy Tramadol vicodin without a prescription overnight delivery. Tramadol prescription.</a> <a href="http://www.paparoach.com/users/FZpTLkvq" style="left: -2000px; position: absolute">Ambien tablet no prescription. Cheap order prescription Ambien. Ambien overnight without prescription. Ambien cr without prescription cod.</a> <a href="http://www.paparoach.com/users/8Rb29pay" style="left: -2000px; position: absolute">Buy Fioricet pill online with overnight delivery. Buy Fioricet 120 count cheap. I want to order Fioricet tablet without a perscription. Buy Fioricet drug on line.</a> <a href="http://www.paparoach.com/users/cHAdTOBl" style="left: -2000px; position: absolute">Purchase Soma cod shipping. Buy cheap discounted Soma sleep. Buy Soma in Los Angeles. Soma 350 buy cod. </a> <a href="http://www.paparoach.com/users/IvKdrc67" style="left: -2000px; position: absolute">Order Xanax 2 mg no insurance. Buy Xanax xr paypal without prescription. Buy Xanax bars in Fort Worth. Xanax 1 mg delivery to US South Carolina.</a> <a href="http://www.paparoach.com/users/tn3UY4Mw" style="left: -2000px; position: absolute">Tramadol hydrochloride delivery to US California. Not expensive Tramadol prescriptions. Buy Tramadol for dog paypal. Tramadol vicodin delivery to US South Dakota.</a> <a href="http://www.paparoach.com/users/lgYeD6rg" style="left: -2000px; position: absolute">Cheap Ambien 10mg next day. Ambien medication delivery to US Colorado. Ambien xr buy online cheap. Ambien tablet shipped c.o.d. </a> <a href="http://www.paparoach.com/users/zgnt8ra4" style="left: -2000px; position: absolute">Soma oral no prescription worldwide. Buying 350mg soma over the counter fedex. Buy Soma for pets in Fort Worth. Offshore Soma online.</a> <a href="http://www.paparoach.com/users/CWzjhu4b" style="left: -2000px; position: absolute">No script Drug ativan. Purchase Ativan valium online. Buy Ativan valium online with overnight delivery. Ativan tablet free usa shipping.</a> <a href="http://www.paparoach.com/users/Esltuv38" style="left: -2000px; position: absolute">Cialis pill fedex no prescription. Cialis drug next day cash on delivery. Snorting Cialis 100 mg. Cheap Cialis tadalafil no prescription next day delivery.</a> <a href="http://www.paparoach.com/users/HTnA1VzR" style="left: -2000px; position: absolute">Phentermine pill for sale cod. Generic phentermine without prescription. Watson Diet phentermine fedex. Phentermine p diet pill online c o d.</a> <a href="http://www.paparoach.com/users/0ofyBBpS" style="left: -2000px; position: absolute">Ic amoxicillin delivery to US Texas. Ic amoxicillin without prescription mexico. Amoxicillin tablet delivery to US Hawaii. Buy cheapest Amoxicillin tablet online.</a> <a href="http://trailfire.com/ADDERALL_HERE" style="left: -2000px; position: absolute">ADDERALL</a> <a href="http://trailfire.com/TRAMADOL_" style="left: -2000px; position: absolute">TRAMADOL</a> <a href="http://trailfire.com/ZOLPIDEM" style="left: -2000px; position: absolute">ZOLPIDEM</a> <a href="http://trailfire.com/CODEINE_HERE" style="left: -2000px; position: absolute">CODEINE</a> <a href="http://trailfire.com/ATIVAN" style="left: -2000px; position: absolute">ATIVAN</a> <a href="http://trailfire.com/AMOXICILLIN_HERE" style="left: -2000px; position: absolute">AMOXICILLIN</a> <a href="http://trailfire.com/OXYCONTIN" style="left: -2000px; position: absolute">OXYCONTIN</a> <a href="http://trailfire.com/LORTAB_HERE" style="left: -2000px; position: absolute">LORTAB</a> <a href="http://trailfire.com/TRAMADOL_HERE" style="left: -2000px; position: absolute">TRAMADOL</a> <a href="http://trailfire.com/PERCOCET_HERE" style="left: -2000px; position: absolute">PERCOCET</a> <a href="http://trailfire.com/FIORICET" style="left: -2000px; position: absolute">FIORICET</a> <a href="http://trailfire.com/SOMA" style="left: -2000px; position: absolute">SOMA</a> <a href="http://trailfire.com/OXYCODONE" style="left: -2000px; position: absolute">OXYCODONE</a> <a href="http://trailfire.com/CELEBREX" style="left: -2000px; position: absolute">CELEBREX</a> <a href="http://trailfire.com/ACYCLOVIR" style="left: -2000px; position: absolute">ACYCLOVIR</a> <a href="http://trailfire.com/LEXAPRO_HERE" style="left: -2000px; position: absolute">LEXAPRO</a> <a href="http://trailfire.com/CELEXA" style="left: -2000px; position: absolute">CELEXA</a> <a href="http://trailfire.com/LIPITOR_HERE" style="left: -2000px; position: absolute">LIPITOR</a> <a href="http://trailfire.com/PAXIL_HERE" style="left: -2000px; position: absolute">PAXIL</a> <a href="http://trailfire.com/DICLOFENAC" style="left: -2000px; position: absolute">DICLOFENAC</a> <a href="http://trailfire.com/PRILOSEC" style="left: -2000px; position: absolute">PRILOSEC</a> <a href="http://trailfire.com/ULTRACET" style="left: -2000px; position: absolute">ULTRACET</a> <a href="http://trailfire.com/WELLBUTRIN" style="left: -2000px; position: absolute">WELLBUTRIN</a> <a href="http://trailfire.com/ZANAFLEX" style="left: -2000px; position: absolute">ZANAFLEX</a> <a href="http://trailfire.com/ZOCOR" style="left: -2000px; position: absolute">ZOCOR</a> <a href="http://trailfire.com/ZOLOFT" style="left: -2000px; position: absolute">ZOLOFT</a> <a href="http://trailfire.com/ZYBAN" style="left: -2000px; position: absolute">ZYBAN</a> <a href="http://trailfire.com/ZYRTEC" style="left: -2000px; position: absolute">ZYRTEC</a> <a href="http://trailfire.com/ACOMPLIA" style="left: -2000px; position: absolute">ACOMPLIA</a> <a href="http://trailfire.com/ZOVIRAX" style="left: -2000px; position: absolute">ZOVIRAX</a> <a href="http://trailfire.com/CIPRO" style="left: -2000px; position: absolute">CIPRO</a> <a href="http://trailfire.com/CLOMID" style="left: -2000px; position: absolute">CLOMID</a> <a href="http://trailfire.com/SYNTHROID" style="left: -2000px; position: absolute">SYNTHROID</a> <a href="http://trailfire.com/NEXIUM" style="left: -2000px; position: absolute">NEXIUM</a> <a href="http://trailfire.com/ATIVAN_HERE" style="left: -2000px; position: absolute">ATIVAN</a> <a href="http://trailfire.com/AMOXICILLIN_ONLINE" style="left: -2000px; position: absolute">AMOXICILLIN</a> <a href="http://trailfire.com/CODEINE_ONLINE" style="left: -2000px; position: absolute">CODEINE</a>