How to use shufflejs - 8 common examples

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 ursa-majors / co-ment / client / src / containers / PostsGrid.jsx View on Github external
.then(() => {
        // initialize a shuffle instance.
        this.shuffle = new Shuffle(this.element, {
          itemSelector: '.post',
          sizer: document.getElementsByClassName('sizer')[0],
          delimeter: ',',
          initialSort: {
            by: sortByDate,
            reverse: true,
          },
          group: filterGroup,
        });
        this.shuffle.resetItems();
        this.addShuffleEventListeners();
      });
    // temporarily set data attribute taborder = 'visual' to focusable eleements outside this commponent
github ursa-majors / co-ment / client / src / containers / PostsGrid.jsx View on Github external
this.shuffle.filter((element, shuffle) => {
            // If there is a current filter applied, ignore elements that don't match it.
            if (shuffle.group !== Shuffle.ALL_ITEMS) {
              // Get the item's groups.
              const groups = element.getAttribute('data-groups');
              // remove empty values from filter list
              let activeFilters = shuffle.group.filter((el) => el !== '');
              // for each active filter, check against element groups
              for (i=0; i
github meine-stadt-transparent / meine-stadt-transparent / mainapp / assets / js / persons.js View on Github external
$el.attr('tabindex', lastTabindex);
            lastTabindex++;
        };

        // Try to find all selectable elements that appear _after_ this grid and set the tabindex explicitly
        $gridEl.parents().prevAll().find("a, input, button, [tabindex]").filter(":visible:not(:disabled)").each((i, el) => overrideTabindex($(el)));

        getSortedItems().forEach(($item) => {
            $item.find("a").attr("tabindex", lastTabindex);
            lastTabindex++;
        });

        // Try to find all selectable elements that appear _after_ this grid and set the tabindex explicitly
        $gridEl.parents().nextAll().find("a, input, button, [tabindex]").filter(":visible:not(:disabled)").each((i, el) => overrideTabindex($(el)));
    };
    grid.on(Shuffle.EventType.LAYOUT, () => {
        recalcTabindexes();
    });
    recalcTabindexes();

    if ($gridEl.parents(".tab-pane").length > 0) {
        // We're inside a tab content, so the list might disappear and reappear
        let tabId = $gridEl.parents(".tab-pane").attr("id"),
            $tab = $(".nav-link[href=\"#" + tabId + "\"]");
        $tab.on("shown.bs.tab hidden.bs.tab", () => {
            // TODO: We don't actually need to update and show the effect every time
            grid.update();
        });
    }

    let $groupRadios = $(".filter-organizations input[type=radio]"),
        $groupDropdownLinks = $(".filter-organizations a"),
github z-9527 / react-admin-master / src / routes / Other / AnimationDemo / index.js View on Github external
componentDidMount(){
    this.shuffle = new Shuffle(this.shuffleDemo, {
      itemSelector: '.shuffle-item',
      sizer: this.sizer,
    });
  }
  componentDidUpdate() {
github z-9527 / react-admin-master / src / routes / Other / GalleryDemo / index.js View on Github external
componentDidMount(){
    this.shuffle = new Shuffle(this.shuffleDemo, {
      itemSelector: '.photo-item',
      sizer: this.sizer,
    });
  }
  componentDidUpdate() {
github ursa-majors / co-ment / client / src / containers / PostsGrid.jsx View on Github external
addShuffleEventListeners = () => {
    this.shuffle.on(Shuffle.EventType.LAYOUT, (data) => {
      PostsGrid.adjustBkgSize();
    });

    this.shuffle.on(Shuffle.EventType.REMOVED, (data) => {
      PostsGrid.adjustBkgSize();
    });
  }
github ursa-majors / co-ment / client / src / containers / PostsGrid.jsx View on Github external
addShuffleEventListeners = () => {
    this.shuffle.on(Shuffle.EventType.LAYOUT, (data) => {
      PostsGrid.adjustBkgSize();
    });

    this.shuffle.on(Shuffle.EventType.REMOVED, (data) => {
      PostsGrid.adjustBkgSize();
    });
  }
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