npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

filtery

v1.2.0

Published

Simple JavaScript plugin for easy filterable masonry grid

Downloads

2

Readme

filtery

A simple JavaScript to make filterable masonry layouts

Getting Started

  1. Installation
  2. Basic Usage
  3. Options
  4. JavaScript Events

Installation

You can install this filtery.js using NPM, with the following command,

$ npm install filtery

Refer to the releases page to download it manually.

Basic Usage

With jQuery,

$(selector).filtery( [options] );

With Vanilla JavaScript,

var filtery = new Filtery(document.querySelector(selector) [, options] );

where selector is a string containing the selector expression for the grid object, and options (optional) is a JSON object containing custom settings (Refer to Options).

In HTML,

<ul id="filter">
    <li data-filter="all"> <a href="#"> <...> </a> <li>
    <li data-filter="example"> <a href="#"> <...> </a> <li>
    <...>
</ul>

<div id=selector>
    <div data-category="example" class="item"> <...> </div>
    <...>
</div>

Options

Here is a list of the available options with their default values,

With jQuery,

$("#filtery").filtery({
    itemSelector: '.item',
    columns: 3,
    gap: 10,
    animationDuration: 400,
    responsive: {}
});

With Vanilla JavaScript,

var filtery = new Filtery(document.querySelector("#filtery"), {
    itemSelector: '.item',
    columns: 3,
    gap: 10,
    animationDuration: 400,
    responsive: {}
});
  • itemSelector: the selector expression for the elements of the grid.
  • columns: the number of columns in the grid.
  • gap: the gap between each item in the grid (in px), basically the margin.
  • animationDuration: the duration of the animation of the items in the grid.
  • responsive: contains the media queries for a responsive grid. It can contain all of the above options.
    • Example:
      responsive: {
          1280: {
              columns: 3
          },
          991: {
              columns: 2
          },
          0: {
              columns: 1
          }
      }

JavaScript Events

To fix some issues with other plugins that register the offsets of elements below a grid before the items are ordered (like Waypoints or AOS), two events were added that get dispatched on Filtery elements: filtery:load, that triggers when the grid is loaded and the items are ordered, and filtery:resize, that triggers when the grid is refreshed after resizing the window.

Example:

$("#filtery").on('filtery:load', function () {
    console.log("Filtery grid has loaded");
});

$("#filtery").on('filtery:resize', function () {
    console.log("Filtery grid has been resized");
});