Skip to content

Feature Request: Randomization #4

Open
@ChristopherWerby

Description

@ChristopherWerby

It would be great to add a random option (default false).

I found a likely jQuery randomization function on Stack Overflow
ref: http://stackoverflow.com/questions/14555415/how-to-randomly-sort-list-items

$.fn.randomize = function(selector){
    var $elems = selector ? $(this).find(selector) : $(this).children(),
        $parents = $elems.parent();

    $parents.each(function(){
        $(this).children(selector).sort(function(){
            return Math.round(Math.random()) - 0.5;
        }).detach().appendTo(this);
    });

    return this;
};

Thanks for the excellent plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions