Logo v2.3.1
Image Description

No Results

  • Get Support
  • Preview Demo
Logo v2.3.1
  • Docs
  • Snippets
  • Documentation
  • Introduction
  • Getting started
  • Getting Started
  • Gulp
  • Customization
  • Credits
  • Changelog
  • Design & Graphics
  • Bootstrap Icons
  • Duotone Icons
  • Illustrations
  • Figma
  • Components
  • Accordion
  • Alerts
  • Avatars
  • Badge
  • Banners
  • Breadcrumb
  • Buttons
  • Cards
  • Collapse
  • Column Divider
  • Devices
  • Divider
  • Dropdowns
  • List Group
  • Lists
  • Modal
  • Offcanvas
  • Pagination
  • Popovers
  • Progress
  • Shapes
  • Spinners
  • Steps
  • Tab
  • Tables
  • Toasts
  • Tooltips
  • Typography
  • Navbars
  • Navbar
  • Navs
  • Mega Menu
  • Scrollspy
  • Basic forms
  • Basic Forms
  • Checks & Switches
  • Input Group
  • Media
  • Fullscreen Lightbox
  • Swiper Touch Slider
  • Others
  • Sticky Block
  • Countdown
  • Sorting (Shuffle.js)
  • Go To
  • Show Animation
  • Typedjs
  • Utilities
  • Backgrounds
  • Borders
  • Colors
  • Lines
  • Links
  • Position
  • Rotations
  • Shadows
  • Sizing
  • Spacing
  • Z-index

Sorting (Shuffle.js)

Categorize, sort, and filter a responsive grid of items.

Shuffle documentation

How to use

Copy-paste the following <script> near the end of your pages under JS Implementing Plugins to enable it.

        
          <script src="./assets/vendor/shufflejs/dist/shuffle.js"></script>
        
      

Copy-paste the init function under JS Plugins Init., before the closing </body> tag, to enable it.

        
          <script>
            (function() {
              // INITIALIZATION OF SHUFFLE
              // =======================================================
              class ShufflePorfolio {
                constructor(element) {
                  this.element = element;
                  this.shuffle = new Shuffle(element, {
                    itemSelector: '.js-shuffle-item',
                    speed: 500
                  })

                  this.addFilterButtons()
                }

                addFilterButtons() {
                  const options = document.querySelector('.js-filter-options')
                  if (!options) {
                    return
                  }

                  const filterButtons = Array.from(options.children)
                  const onClick = this._handleFilterClick.bind(this)
                  filterButtons.forEach((button) => {
                    button.addEventListener('click', onClick, false)
                  });
                }

                _handleFilterClick(evt) {
                  const btn = evt.currentTarget.firstElementChild
                  const isActive = btn.classList.contains('active')
                  const btnGroup = btn.getAttribute('data-group')

                  this._removeActiveClassFromChildren(btn.parentNode.parentNode)

                  let filterGroup
                  if (isActive) {
                    btn.classList.remove('active')
                    filterGroup = Shuffle.ALL_ITEMS
                  } else {
                    btn.classList.add('active')
                    filterGroup = btnGroup
                  }

                  this.shuffle.filter(filterGroup)
                }

                _removeActiveClassFromChildren(parent) {
                  const { children } = parent
                  for (let i = children.length - 1; i >= 0; i--) {
                    children[i].firstElementChild.classList.remove('active')
                  }
                }
              }

              new ShufflePorfolio(document.querySelector('.js-shuffle'))
            })()
          </script>
        
      

Basic example

  • Preview
  • HTML
  • All
  • Branding
  • Development
  • Product Design
Image Description
Branding
Hondo Loggy
Image Description
Development
Wibbitz
Image Description
Product Design
The Hub
Image Description
Product Design
Starbucks
Image Description
Product Design
TATT
Image Description
Branding
Slack Agency
              
                <div class="d-flex justify-content-center mb-5">
                  <!-- Nav -->
                  <ul class="js-filter-options nav nav-link-gray nav-lg" id="portfolioTab" role="tablist">
                    <li class="nav-item" role="presentation">
                      <a class="nav-link active" href="javascript:;" data-group="all">All</a>
                    </li>
                    <li class="nav-item" role="presentation">
                      <a class="nav-link" href="javascript:;" data-group="branding">Branding</a>
                    </li>
                    <li class="nav-item" role="presentation">
                      <a class="nav-link" href="javascript:;" data-group="development">Development</a>
                    </li>
                    <li class="nav-item" role="presentation">
                      <a class="nav-link" href="javascript:;" data-group="product-design">Product Design</a>
                    </li>
                  </ul>
                  <!-- End Nav -->
                </div>

                <div class="js-shuffle row row-cols-1 row-cols-sm-2 row-cols-md-3">
                  <div class="js-shuffle-item col-sm-6 mb-5" data-groups='["branding"]'>
                    <!-- Card -->
                    <a class="card card-flush card-transition" href="../portfolio-case-study.html">
                      <img class="card-img-top" src="../assets/img/600x650/img1.jpg" alt="Image Description">
                      <div class="card-body">
                        <span class="card-subtitle text-body">Branding</span>
                        <h5 class="card-title">Hondo Loggy</h5>
                      </div>
                    </a>
                    <!-- End Card -->
                  </div>
                  <!-- End Col -->

                  <div class="js-shuffle-item col-sm-6 mb-5" data-groups='["development"]'>
                    <!-- Card -->
                    <a class="card card-flush card-transition" href="../portfolio-case-study.html">
                      <img class="card-img-top" src="../assets/img/600x650/img2.jpg" alt="Image Description">
                      <div class="card-body">
                        <span class="card-subtitle text-body">Development</span>
                        <h5 class="card-title">Wibbitz</h5>
                      </div>
                    </a>
                    <!-- End Card -->
                  </div>
                  <!-- End Col -->

                  <div class="js-shuffle-item col-sm-6 mb-5" data-groups='["product-design"]'>
                    <!-- Card -->
                    <a class="card card-flush card-transition" href="../portfolio-case-study.html">
                      <img class="card-img-top" src="../assets/img/600x650/img3.jpg" alt="Image Description">
                      <div class="card-body">
                        <span class="card-subtitle text-body">Product Design</span>
                        <h5 class="card-title">The Hub</h5>
                      </div>
                    </a>
                    <!-- End Card -->
                  </div>
                  <!-- End Col -->

                  <div class="js-shuffle-item col-sm-6 mb-5" data-groups='["product-design"]'>
                    <!-- Card -->
                    <a class="card card-flush card-transition" href="../portfolio-case-study.html">
                      <img class="card-img-top" src="../assets/img/600x650/img4.jpg" alt="Image Description">
                      <div class="card-body">
                        <span class="card-subtitle text-body">Product Design</span>
                        <h5 class="card-title">Starbucks</h5>
                      </div>
                    </a>
                    <!-- End Card -->
                  </div>
                  <!-- End Col -->

                  <div class="js-shuffle-item col-sm-6 mb-5" data-groups='["product"]'>
                    <!-- Card -->
                    <a class="card card-flush card-transition" href="../portfolio-case-study.html">
                      <img class="card-img-top" src="../assets/img/600x650/img5.jpg" alt="Image Description">
                      <div class="card-body">
                        <span class="card-subtitle text-body">Product Design</span>
                        <h5 class="card-title">TATT</h5>
                      </div>
                    </a>
                    <!-- End Card -->
                  </div>
                  <!-- End Col -->

                  <div class="js-shuffle-item col-sm-6 mb-5" data-groups='["branding"]'>
                    <!-- Card -->
                    <a class="card card-flush card-transition" href="../portfolio-case-study.html">
                      <img class="card-img-top" src="../assets/img/600x650/img8.jpg" alt="Image Description">
                      <div class="card-body">
                        <span class="card-subtitle text-body">Branding</span>
                        <h5 class="card-title">Slack Agency</h5>
                      </div>
                    </a>
                    <!-- End Card -->
                  </div>
                  <!-- End Col -->
                </div>
                <!-- End Row -->