A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more

Overview

MixItUp 3

Build Status Coverage Status jsDelivr Hits

MixItUp is a high-performance, dependency-free library for animated DOM manipulation, giving you the power to filter, sort, add and remove DOM elements with beautiful animations.

MixItUp plays nice with your existing HTML and CSS, making it a great choice for responsive layouts and compatible with inline-flow, percentages, media queries, flexbox and more.

For a live sandbox, full documentation, tutorials and more, please visit kunkalabs.com/mixitup.

Migrating from MixItUp 2? Check out the MixItUp 3 Migration Guide.

Licensing

MixItUp is open source and free to use for non-commercial, educational and non-profit use. For use in commercial projects, a commercial license is required. For licensing information and FAQs please see the MixItUp Licenses page.

Documentation

Browser Support

MixItUp 3 has been tested for compatibility with the following browsers.

  • Chrome 16+
  • Firefox 16+
  • Safari 6.2+
  • Yandex 14+
  • Edge 13+
  • IE 10+ (with animations), IE 8-9 (no animations)

Getting Started

Contents

Most commonly, MixItUp is applied to a "container" of "target" elements, which could be a portfolio of projects, a list of blog posts, a selection of products, or any kind of UI where filtering and/or sorting would be advantageous.

To get started, follow these simple steps:

Building the Container

By default, MixItUp will query the container for targets matching the selector '.mix'.

<div class="container">
    <div class="mix category-a" data-order="1"></div>
    <div class="mix category-b" data-order="2"></div>
    <div class="mix category-b category-c" data-order="3"></div>
    <div class="mix category-a category-d" data-order="4"></div>
</div>

Targets can be filtered using any valid selector e.g. '.category-a', and are sorted via optional custom data attributes e.g. 'data-order'.

Further reading: Marking-up MixItUp Containers

Building Controls

One way that filtering and sorting happens is when controls are clicked. You may use any clickable element as a control, but <button type="button"> is recommended for accessibility.

Filter Controls

Filter controls are queried based on the presence of a data-filter attribute, whose value must be 'all', 'none', or a valid selector string e.g. '.category-a'.

<button type="button" data-filter="all">All</button>
<button type="button" data-filter=".category-a">Category A</button>
<button type="button" data-filter=".category-b">Category B</button>
<button type="button" data-filter=".category-c">Category C</button>

Further reading: Filtering with MixItUp

Sort Controls

Sort controls are queried based on the presence of a data-sort attribute, whose value takes the form of a "sort string" made up of the name of the attribute to sort by, followed by an optional colon-separated sorting order e.g. 'order', 'order:asc', 'order:desc'.

<button type="button" data-sort="order:asc">Ascending</button>
<button type="button" data-sort="order:descending">Descending</button>
<button type="button" data-sort="random">Random</button>

The values 'default' and 'random' are also valid, with 'default' referring to the original order of target elements in the DOM at the time of mixer instantiation.

Further reading: Sorting with MixItUp

Styling the Container

While MixItUp can be added on top of any existing CSS layout, we strongly recommend inline-block or flexbox-based styling over floats and legacy grid frameworks when dealing with grid-based designs for a number of reasons.

Further reading: MixItUp Grid Layouts

Loading MixItUp

Firstly, load the MixItUp JavaScript library using the preferred method for your project.

Script Tag

The most simple way to load MixItUp in your project is to include it via a <script> tag before the closing </body> tag on your page.

        ...

        <script src="/path/to/mixitup.min.js"></script>
    </body>
</html>

With this technique, the MixItUp factory function will be made available via the global variable mixitup.

Module Import

If you are building a modular JavaScript project with Webpack, Browserify, or RequireJS, MixItUp can be installed using your package manager of choice (e.g. npm, jspm, yarn) and then imported into any of your project's modules.

npm install mixitup --save

// ES2015

import mixitup from 'mixitup';
// CommonJS

var mixitup = require('mixitup');
// AMD

require(['mixitup'], function(mixitup) {

});

Creating a Mixer

With the mixitup() factory function available, you may now instantiate a "mixer" on your container to enable MixItUp functionality.

Call the factory function passing a selector string or a reference to your container element as the first parameter, and a the newly instantiated mixer will be returned.

Example: Instantiating a mixer with a selector string
var mixer = mixitup('.container');
Example: Instantiating a mixer with an element reference
var mixer = mixitup(containerEl);

Your mixer is now ready for you to interact with, either via its controls (see above), or its API (see Mixer API Methods). Click a control or call an API method to check that everything is working correctly.

Configuration

If you wish to customize the functionality of your mixer, an optional "configuration object" can be passed as the second parameter to the mixitup function. If no configuration object is passed, the default settings will be used.

Further reading: Configuration Object

Example: Passing a configuration object
var mixer = mixitup(containerEl, {
    selectors: {
        target: '.blog-item'
    },
    animation: {
        duration: 300
    }
});

Using the API

If you wish to interact with your mixer via its API, the mixer reference returned by the factory function can be used to call API methods.

Example: Calling an API method
var mixer = mixitup(containerEl);

mixer.filter('.category-a');

Further reading: Mixer API Methods

Building a modern JavaScript application?

You may wish to use MixItUp 3's new "dataset" API. Dataset is designed for use in API-driven JavaScript applications, and can be used instead of DOM-based methods such as .filter(), .sort(), .insert(), etc. When used, insertion, removal, sorting and pagination can be achieved purely via changes to your data model, without the uglyness of having to interact with or query the DOM directly.

Further reading: Using the Dataset API

Comments
  • Issues loading MixItUp extensions using ES6 modules and Webpack

    Issues loading MixItUp extensions using ES6 modules and Webpack

    Hello,

    I'm following the documentation to call the plugin programmatically:

    import mixitup from 'mixitup'
    import mixitupPagination from '../mixitup-pagination'
    mixitup.use(mixitupPagination)
    

    But I always get this error in the console:

    Uncaught Error: [MixItUp Pagination] MixItUp core not found

    This is not happening when using Mixitup alone.

    MixItUp Pagination MixItUp Core 
    opened by jimblue 31
  • width 100% not working correctly

    width 100% not working correctly

    hi, first of all, great work! beautifull plugin :D

    now the problem, you can reproduce the problem with the demo "loading-animation" adding about 80 or more "mix" elements to the container (i test this in chrome and firefox). The problem is : while the loading animation is runing the "mix" elements wont use 100% of the width, only after the loading animation finish they all update to the correct width. Thank.

    opened by seltix5 17
  • Multifilter and jQuery Chosen plugin

    Multifilter and jQuery Chosen plugin

    Hi,

    I'm doing some tests with MixitUp multifilter and would like to combine it with the Chosen plugin (link) that we are currently using. However using them both does not seem to work.

    `$( document ).ready(function() { $(".chosen-select").chosen(); var mixer = mixitup('ul#listIndic', { selectors: { target: 'li.elemIndic' }, multifilter: { enable: true }, callbacks: { onMixStart: function(state, futureState) { console.log(futureState.activeFilter.selector); } } });

    });`

    Multifilter is working if I comment the "chosen" line. However when combining with Mixitup multifilter, filtering won't work anymore (nothing shows in the console, so it seems it's not getting to onMixStart). If you have a working demo with multifilter, could you try to add Chosen to see what the problem could be?

    MixItUp MultiFilter Third-party Integration 
    opened by mungerj 15
  • Range Slider combined into one slider min/max

    Range Slider combined into one slider min/max

    Is there any way to combine the mix and max into one (two handles)? https://demos.kunkalabs.com/mixitup/filtering-by-range/

    I will need to have pagination too and will buy a license but need to know if its possible to have a "multislider". I can't find any examples of that already in mixitup.

    I'm aiming for a slider like this: http://jqueryui.com/slider/#range Or: http://ionden.com/a/plugins/ion.rangeSlider/en.html Or: https://leaverou.github.io/multirange/ Or: https://codepen.io/Pierre_Hamel/pen/ocJEH Or: https://refreshless.com/nouislider/ Or: http://jsfiddle.net/j08691/sh0q62b7/

    MixItUp Core Demos Controls 
    opened by fourroses666 14
  • Problem Items Disappears .

    Problem Items Disappears .

    Hi, Sorry To Disturb you,

    When I Work with The V2, The Console Work But My Last Section in the Html Document which is Contact Form Disappears in The Preview until I focus on it by clicking the link in the navbar.

    This is the link to the Preview Screen of what Happened : (https://imgur.com/3q9vDqH) .

    This Is a link to the preview when I focus on it : (https://imgur.com/tfcCcjZ) .

    opened by medabkari 13
  • Publish to npm?

    Publish to npm?

    It seems while you have set up a npm package.json you didn’t publish the package to npmjs.org registry. Could you please do this for the curent version and all upcoming versions, too? This would ensure that you can fetch the package not only with bower but also with npm.

    opened by anselmh 13
  • Angular.js issue

    Angular.js issue

    Hi.

    I've got a little plunker here (http://plnkr.co/edit/Y49WQrHsuiLpYXS9JAIG?p=preview) trying to show contacts, but somehow mixitup only display the first item in the list.

    I can't seem to figure out why.

    Thanks

    Bug 
    opened by ghost 13
  • MixItUp Pagination: Add onPaginateStart/onPaginateEnd callbacks

    MixItUp Pagination: Add onPaginateStart/onPaginateEnd callbacks

    Currently, users are limited to using the catch all onMixStart/onMixEnd callbacks, and using state checking logic to determine if a pagination operation occurred.

    For example:

    var activePage = 1;
    var activeLimit = 8;
    
    var mixer = mixitup(containerEl, {
        load: {
            page: activePage
        }
        pagination: {
            limit: activeLimmit
        },
        callbacks: {
            onMixEnd: function(state) {
                if (state.activePagination.limit === activeLimit && state.activePagination.page === activePage) return;
    
                // Pagination state has changed:
    
                activePage = state.activePagination.page;
                activeLimit = state.activePagination.limit;
    
                paginationCallback();
            }
        }
    });
    
    function paginationCallback() {
        // do something only when pagination state has changed
    }
    

    Adding two new paginate specific callbacks would make things a lot easier for people wanting to trigger some custom functionality (typically scroll to top of container) on page change etc.

    Enhancement MixItUp Pagination 
    opened by patrickkunka 12
  • Ensure container height larger than items

    Ensure container height larger than items

    When hiding / showing items it happens sometimes that the container's height changes faster than the items' opacities. This causes items to get "cut off" at the bottom. I removed the fade effect to make this issue more visible.

    I'm using a flexbox layout.

    My Configuration:

    {
        animation: {
            effects: 'stagger(50ms) scale(0.5)',
            duration: 40000,
            easing: 'ease',
            perspectiveOrigin: '50% 0',
            animateChangeLayout: true,
            animateResizeTargets: true
        },
        controls: {
            enable: false
        },
        layout: {
            display: 'block',
            containerClassFail: 'empty'
        },
        selectors: {
            target: '.feed-item'
        }
    }
    

    screen shot 2016-06-29 at 11 21 12

    Geometry 
    opened by CupOfTea696 12
  • [MixItUp MultiFilter] Not Working on iOS

    [MixItUp MultiFilter] Not Working on iOS

    Hello Everyone,

    Just implemented MixItUp Multifilter on my project and it works like a charm on desktop browsers : https://www.masterthehandpan.com/mix-it-up-handpan-makers-directory

    BUT it does NOT work on iOS Browsers. Attached 2 screen shots where you'll see the errors I get on Safari or Chrome

    • Safari : This web page was reloaded because an error occured
    • Chrome : Something went wrong...

    Any idea of what's going on ? Any help would be really appreciated

    Thank you

    img_1961

    img_1960

    opened by timselay 11
  • "Force sort" functionality

    I have a list of elements that can be marked as 'complete'. I'm using the sort functionality to locate complete items at the bottom of the list. This works fine as a default state, or if I switch between sorting methods - but if an item becomes complete and I trigger the currently active sort() again nothing happens. I hoped that forceRefresh() would get around this, but it doesn't seem to re-sort the list based on the set up config.

    How can I ask a mixitup instance to re-sort the list?

    Enhancement 
    opened by nathanhornby 11
  • Provide examples on how to use mixitup inside Next.js

    Provide examples on how to use mixitup inside Next.js

    I'm using mixitup in my next js project but and as soon as i import the plugin in my index page it will return this error:

    "ReferenceError: window is not defined"

    I also asked question about this problem in stackoverflow, but it didn't solve my problem.

    How should i solve this issue?

    Can you add next js example to your documentation?

    opened by hosseinfallah72 0
  • Human Readable list combined with reset buttons

    Human Readable list combined with reset buttons

    Can you combine the logic from this issue post: https://github.com/patrickkunka/mixitup/issues/390 with the ability to add a reset button for each of those active filters?

    opened by redroosterdesign 0
  • Using an anchor tag for the mix element causes animation / transition issues

    Using an anchor tag for the mix element causes animation / transition issues

    This is less of an issue and more of a courtesy for anyone who runs into this, but using an anchor tag for the elements that get mixed will caused odd animation issues. They are seemingly unsolvable regardless of what layout you use, inline, flexbox, float, etc.

    opened by amirkhan81 0
  • MultiFilter - clear text input without mixing

    MultiFilter - clear text input without mixing

    First off, MixItUp has beed a life saver for the project I'm working on. Thank you!

    Is there a way to clear the text input without triggering a mix action?

    I have a search bar and filter toggles that are in separate sections of my page. Each has a "clear search" buttons that should reset everything. Using setFilterGroupSelectors() and parseFilterGroups() resets the mixer, but doesn't clear the text input. Clearing the text before or after that creates a second mix action and a jumpy delay to the results.

    --- MAIN SECTION ---
    
    <form id="search-wrap">
        <div>
            <fieldset data-filter-group id="filter-search" class="search-bar">
                <input type="text" data-search-attribute="data-name" placeholder="Search...">
                <button class="clear-search-bar" type="reset">X</button>
            </fieldset>
            <div class="button-wrap">
                <button type="button" class="large green icon filter-open">
                    <p class="btn-txt">Show Filters</p>
                    <img src="./img/icons/filter-icon.svg" alt="filter icon">
                </button>
            </div>
            <div class="button-wrap">
                <button type="button" class="large gray icon filter-reset" tabindex="-1">
                    <p class="btn-txt">Clear Search</p>
                    <span>X</span>
                </button>
            </div>
        </div>
    </form>
    
    <section class="results mixContainer">
        <div class="mix default">
            <p>We didn't find anything matching your search.</p>
        </div>
    </section>
    
    --- SIDE MENU SECTION ---
    
    <aside id="filter-menu" class="menu open-filter">
        <form class="filters">
    
            <label class="drop">
                <input type="checkbox" checked>
                <h2>Skills<span>⌃</span></h2>
                <div class="drop-list">
                    <ul class="buttons" data-filter-group="group1" data-logic="and">
                        <button type="button" class="filter" data-toggle=".1">group1 - 1</button>
                        <button type="button" class="filter" data-toggle=".2">group1 - 2</button>
                        <button type="button" class="filter" data-toggle=".3">group1 - 3</button>
                        <button type="button" class="filter" data-toggle=".4">group1 - 4</button>
                        <button type="button" class="filter" data-toggle=".5">group1 - 5</button>
                        <button type="button" class="filter" data-toggle=".6">group1 - 6</button>
                    </ul>
                </div>
            </label>
    
            <label class="drop">
                <input type="checkbox" checked>
                <h2>Industries<span>⌃</span></h2>
                <div class="drop-list">
                    <ul class="buttons" data-filter-group="group2">
                        <label class="button-check">
                            <input type="checkbox" value=".1"/>
                            <p>group2 - 1</p>
                            <div class="back"></div>
                        </label>
                        <label class="button-check">
                            <input type="checkbox" value=".2">
                            <p>group2 - 2</p>
                            <div class="back"></div>
                        </label>
                        <label class="button-check">
                            <input type="checkbox" value=".3">
                            <p>group2 - 3</p>
                            <div class="back"></div>
                        </label>
                        <label class="button-check">
                            <input type="checkbox" value=".4">
                            <p>group2 - 4</p>
                            <div class="back"></div>
                        </label>
                        <label class="button-check">
                            <input type="checkbox" value=".5">
                            <p>group2 - 5</p>
                            <div class="back"></div>
                        </label>
                    </ul>
                </div>
            </label>
        </form>
    
        <div class="button-bar">
            <button class="large gray filter-reset">Clear Filters</button>
            <button class="large blue filter-close">Close</button>
        </div>
    
    </aside>
    
    --- SCRIPT ---
    
    // CREATE MIXITUP
    homeMixer = mixitup($('.results'),
    {
        pagination: {
            limit: 12,
            loop: true,
            hidePageListIfSinglePage: true,
            hidePageStatsIfSinglePage: true,
            maintainActivePage: false
        },
        multifilter:
        {
            enable: true,
            keyupThrottleDuration: 500
        },
        load:
        {
            filter: 'none'
        },
        controls: {
            toggleLogic: 'and',
            toggleDefault: 'none'
        },
        animation:
        {
            duration: 500,
            nudge: false,
            reverseOut: false,
            effects: "fade"
        },
        callbacks:
        {
            onMixFail: function(state)
            {
                homeMixer.filter('.default');
            }
        }
    });
    
    // ON CLICK - RESET BUTTONS
    $(document).on('click', '.filter-reset', function()
    {
        homeMixer.setFilterGroupSelectors('group1', []);
        homeMixer.setFilterGroupSelectors('group2', []);
    
        homeMixer.parseFilterGroups(); // <--- TWO SEPARATE
        $('#search-wrap')[0].reset();  // <--- MIX ACTIONS
    });
    
    // MAKE CHECKBOXES TOGGLE LIKE RADIOS
    $('[data-filter-group="group2"] [type="checkbox"]').change(function()
    {  
        if(this.checked){
            $('[data-filter-group="group2"] [type="checkbox"]').not(this).prop('checked', false);
        }    
    });
    
    // DON'T REFRESH THE PAGE
    $(document).on('submit', '#search-wrap', function(event)
    {
        event.preventDefault();
        event.preventDefault ? event.preventDefault() : (event.returnValue = false);
    });
    
    opened by adamerow 0
Releases(v3.3.1)
  • v3.3.1(Oct 1, 2018)

    • Insures dataset uses polyfilled Array.from for old IE support.
    • Fixes support for sorting via element collection. This was not correctly implemented before although documented.
    • Fixes the "filter-by-url" demo to ensure that only leading '.' characters are stripped off rather than any character.
    Source code(tar.gz)
    Source code(zip)
Owner
Patrick Kunka
London-based front-end/full-stack JavaScript engineer specialising in bespoke client-side web applications and JavaScript API design.
Patrick Kunka
Free, open-source crypto trading bot, automated bitcoin / cryptocurrency trading software, algorithmic trading bots. Visually design your crypto trading bot, leveraging an integrated charting system, data-mining, backtesting, paper trading, and multi-server crypto bot deployments.

Free, open-source crypto trading bot, automated bitcoin / cryptocurrency trading software, algorithmic trading bots. Visually design your crypto trading bot, leveraging an integrated charting system, data-mining, backtesting, paper trading, and multi-server crypto bot deployments.

Superalgos 3.1k Jan 1, 2023
ODeck - an free and open source alternative to StreamDeck made with React, React Native, Electron, Socket.IO

ODeck is an free and open source alternative to StreamDeck made with React, React Native, Electron, Socket.IO and some other tecnologies. It allows you to easilly control some features of your computer with the power of a tap on your smartphone.

Willian Rodrigues 27 Nov 21, 2022
Gmail-like client-side drafts and bit more. Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters.

Sisyphus Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters. Descriptio

Alexander Kaupanin 2k Dec 8, 2022
A lightweight jQuery plugin for collapsing and expanding long blocks of text with "Read more" and "Close" links.

Readmore.js V3 alpha I am deprecating the 2.x version of Readmore.js. A new version is coming soon! Check it out and help me test it! Readmore.js A sm

Jed Foster 1.5k Nov 30, 2022
A responsive image polyfill for , srcset, sizes, and more

Picturefill A responsive image polyfill. Authors: See Authors.txt License: MIT Picturefill has three versions: Version 1 mimics the Picture element pa

Scott Jehl 10k Dec 31, 2022
The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML.

List.js Perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on

Jonny Strömberg 10.9k Jan 1, 2023
Drag and drop library for two-dimensional, resizable and responsive lists

GridList Drag and drop library for a two-dimensional resizable and responsive list of items Demo: http://hootsuite.github.io/grid/ The GridList librar

Hootsuite 3.6k Dec 14, 2022
JavaScript Survey and Form Library

SurveyJS is a JavaScript Survey and Form Library. SurveyJS is a modern way to add surveys and forms to your website. It has versions for Angular, jQue

SurveyJS 3.5k Jan 1, 2023
Extensive math expression evaluator library for JavaScript and Node.js

?? Homepage Fcaljs is an extensive math expression evaluator library for JavaScript and Node.js. Using fcal, you can perform basic arithmetic, percent

Santhosh Kumar 93 Dec 19, 2022
Browser fingerprinting library with the highest accuracy and stability.

FingerprintJS is a browser fingerprinting library that queries browser attributes and computes a hashed visitor identifier from them. Unlike cookies a

FingerprintJS 18.1k Dec 31, 2022
autoNumeric is a standalone library that provides live as-you-type formatting for international numbers and currencies.

What is autoNumeric? autoNumeric is a standalone Javascript library that provides live as-you-type formatting for international numbers and currencies

AutoNumeric 1.7k Dec 16, 2022
A platform detection library.

Platform.js v1.3.6 A platform detection library that works on nearly all JavaScript platforms. Disclaimer Platform.js is for informational purposes on

BestieJS Modules 3.1k Dec 31, 2022
A benchmarking library. As used on jsPerf.com.

Benchmark.js v2.1.4 A robust benchmarking library that supports high-resolution timers & returns statistically significant results. As seen on jsPerf.

BestieJS Modules 5.3k Dec 28, 2022
A wrapper library for Jitsi Meet that adds audio spatialization, to be able to create virtual meeting rooms.

A wrapper library for Jitsi Meet that adds audio spatialization, to be able to create virtual meeting rooms.

Sean T. McBeth 1.1k Dec 27, 2022
Solid.js library adding signaling to built-in non-primitives

This package provides signaled versions of Javascript's built-in objects. Thanks to it, all theirs properties will be automatically tracked while using standard API.

Maciej Kwaśniak 40 Dec 29, 2022
This library was designed to be used in SPA framework wrappers for the FingerprintJS Pro Javascript Agent

Framework-agnostic SPA service wrapper. Use it to build a FingerprintJS Pro wrapper for your favorite framework.

FingerprintJS 12 Sep 3, 2022
ChelseaJS - a Javascript library for creative, generative Coding

ChelseaJS is a Javascript library for creative, generative Coding. It's simple and intuitive syntax makes it easy for everyone (including non-coders)

Prakrisht Dahiya 26 Oct 6, 2022
Estrela - a JavaScript library for building reactive web components inspired by lit

Estrela ⭐ Full Reactive Web Components Estrela is a JavaScript library for building reactive web components inspired by lit. Just like Lit, Estrela is

null 50 Oct 31, 2022
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

JavaScript Algorithms and Data Structures This repository contains JavaScript based examples of many popular algorithms and data structures. Each algo

Oleksii Trekhleb 158k Dec 31, 2022