How to use the shufflejs/src/shuffle function in shufflejs

To help you get started, we’ve selected a few shufflejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meine-stadt-transparent / meine-stadt-transparent / mainapp / assets / js / persons.js View on Github external
$(function () {
    let $gridEl = $('.persons-list'),
        sortByName = (el) => {
            return el.getAttribute('data-name').toLowerCase();
        },
        sortByGroup = (el) => {
            return el.getAttribute('data-group-names').toLowerCase();
        },
        grid = new Shuffle($gridEl, {
            itemSelector: 'li.person',
            isCentered: false,
            initialSort: {by: sortByName}
        });

    $gridEl.css("min-height", $gridEl.height() + "px");

    let $sortSelector = $(".sort-selector");
    $sortSelector.find("a").click((ev) => {
        ev.preventDefault();
        let $selectedNode = $(ev.currentTarget),
            sort = $selectedNode.data("sort");
        $sortSelector.find(".current-mode").text($selectedNode.text());
        if (sort === 'name') {
            grid.sort({by: sortByName});
        }

shufflejs

Categorize, sort, and filter a responsive grid of items

MIT
Latest version published 9 months ago

Package Health Score

66 / 100
Full package analysis