Convert Figma logo to code with AI

glidejs logoglide

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

7,271
771
7,271
233

Top Related Projects

39,523

Most modern mobile touch slider with hardware accelerated transitions

28,370

the last carousel you'll ever need

4,828

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.

A lightweight carousel library with fluid motion and great swipe precision.

3,481

Siema - Lightweight and simple carousel in pure JavaScript

Quick Overview

Glide.js is a lightweight, flexible, and dependency-free JavaScript ES6 slider and carousel. It's designed to be fast, simple to use, and highly customizable, making it suitable for various web projects requiring image sliders or carousels.

Pros

  • Lightweight and performant, with no external dependencies
  • Highly customizable with a wide range of options and API methods
  • Responsive and touch-friendly, working well on both desktop and mobile devices
  • Supports multiple slide types, including images, videos, and custom HTML content

Cons

  • Limited built-in effects and transitions compared to some more complex slider libraries
  • Documentation could be more comprehensive, especially for advanced use cases
  • May require additional custom code for complex layouts or animations
  • Not as feature-rich as some larger, more established slider libraries

Code Examples

Creating a basic slider:

new Glide('.glide').mount()

Customizing slider options:

new Glide('.glide', {
  type: 'carousel',
  startAt: 0,
  perView: 3,
  gap: 20,
  autoplay: 3000
}).mount()

Using Glide.js events:

const glide = new Glide('.glide')

glide.on('run.before', () => {
  console.log('Transition started')
})

glide.on('run.after', () => {
  console.log('Transition finished')
})

glide.mount()

Getting Started

  1. Install Glide.js via npm:

    npm install @glidejs/glide
    
  2. Import Glide.js in your JavaScript file:

    import Glide from '@glidejs/glide'
    
  3. Add the necessary HTML structure:

    <div class="glide">
      <div class="glide__track" data-glide-el="track">
        <ul class="glide__slides">
          <li class="glide__slide">Slide 1</li>
          <li class="glide__slide">Slide 2</li>
          <li class="glide__slide">Slide 3</li>
        </ul>
      </div>
    </div>
    
  4. Initialize the slider in your JavaScript:

    new Glide('.glide').mount()
    
  5. Optionally, include Glide.js core styles:

    <link rel="stylesheet" href="node_modules/@glidejs/glide/dist/css/glide.core.min.css">
    

Competitor Comparisons

39,523

Most modern mobile touch slider with hardware accelerated transitions

Pros of Swiper

  • More feature-rich with advanced functionality like virtual slides and parallax effects
  • Larger community and ecosystem, with more frequent updates and third-party extensions
  • Better support for modern JavaScript frameworks (React, Vue, Angular, etc.)

Cons of Swiper

  • Larger file size, which may impact page load times
  • Steeper learning curve due to more complex API and configuration options
  • May be overkill for simple slider needs, potentially leading to unnecessary bloat

Code Comparison

Glide initialization:

new Glide('.glide').mount()

Swiper initialization:

new Swiper('.swiper-container', {
  slidesPerView: 3,
  spaceBetween: 30,
  pagination: {
    el: '.swiper-pagination',
    clickable: true,
  },
})

Both Glide and Swiper are popular JavaScript slider libraries, but they cater to different needs. Glide is lightweight and straightforward, making it ideal for simple slider implementations. Swiper, on the other hand, offers a more comprehensive set of features and better integration with modern web development ecosystems, but at the cost of increased complexity and file size. The choice between the two depends on the specific requirements of your project and the level of customization needed.

28,370

the last carousel you'll ever need

Pros of Slick

  • More extensive feature set, including responsive breakpoints and lazy loading
  • Larger community and ecosystem, with more third-party extensions and resources
  • Better support for older browsers, including IE8+

Cons of Slick

  • Larger file size and potentially heavier performance impact
  • Requires jQuery as a dependency, which may not be ideal for modern projects
  • More complex configuration options, which can be overwhelming for simple use cases

Code Comparison

Slick initialization:

$('.slider').slick({
  slidesToShow: 3,
  slidesToScroll: 1,
  autoplay: true,
  autoplaySpeed: 2000,
});

Glide initialization:

new Glide('.slider', {
  type: 'carousel',
  perView: 3,
  autoplay: 2000,
}).mount();

Both Slick and Glide are popular JavaScript libraries for creating responsive carousels and sliders. Slick offers a more comprehensive set of features and wider browser support, making it suitable for complex projects with legacy requirements. However, it comes at the cost of a larger file size and jQuery dependency.

Glide, on the other hand, is a lightweight and modern alternative that doesn't require jQuery. It has a simpler API and smaller footprint, making it ideal for projects prioritizing performance and minimal dependencies. While it may lack some advanced features found in Slick, Glide provides a solid foundation for creating responsive sliders with a more streamlined approach.

4,828

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.

Pros of Splide

  • More active development and maintenance
  • Supports touch events and swipe gestures out of the box
  • Offers a wider range of built-in options and customizations

Cons of Splide

  • Slightly larger file size
  • May have a steeper learning curve for beginners due to more features

Code Comparison

Glide initialization:

new Glide('.glide').mount()

Splide initialization:

new Splide('.splide').mount()

Both libraries use similar syntax for basic initialization, making it easy to switch between them. However, Splide offers more advanced options for customization:

new Splide('.splide', {
  type: 'loop',
  perPage: 3,
  autoplay: true,
}).mount()

Glide and Splide are both lightweight JavaScript slider libraries, but Splide has gained popularity due to its more frequent updates and broader feature set. While Glide is simpler and may be easier for beginners, Splide offers more flexibility and modern features like touch support. The choice between the two depends on project requirements and developer preferences.

A lightweight carousel library with fluid motion and great swipe precision.

Pros of Embla Carousel

  • Smaller bundle size and better performance optimization
  • More flexible and customizable with advanced features like plugins
  • Better touch and mouse drag support, especially for mobile devices

Cons of Embla Carousel

  • Steeper learning curve due to more complex API
  • Less out-of-the-box styling options compared to Glide
  • Requires more setup and configuration for basic use cases

Code Comparison

Embla Carousel:

import EmblaCarousel from 'embla-carousel'

const embla = EmblaCarousel(emblaNode, { loop: false })

Glide:

import Glide from '@glidejs/glide'

new Glide('.glide').mount()

Embla Carousel requires more explicit configuration, while Glide offers a simpler setup for basic carousels. However, Embla's approach allows for greater flexibility and customization.

Both libraries provide smooth carousel functionality, but Embla Carousel excels in performance and advanced features, making it more suitable for complex projects. Glide, on the other hand, offers a more straightforward implementation for simpler use cases and comes with pre-styled themes.

Ultimately, the choice between Embla Carousel and Glide depends on the project's specific requirements, desired level of customization, and performance needs.

3,481

Siema - Lightweight and simple carousel in pure JavaScript

Pros of Siema

  • Lightweight and minimalistic (only 3KB gzipped)
  • No dependencies, pure JavaScript
  • Simple API with easy customization

Cons of Siema

  • Limited built-in features compared to Glide
  • Less active development and community support
  • No built-in navigation or pagination

Code Comparison

Siema initialization:

const mySiema = new Siema({
  selector: '.siema',
  duration: 200,
  easing: 'ease-out',
  perPage: 1,
  startIndex: 0,
  draggable: true,
  multipleDrag: true,
  threshold: 20,
  loop: false,
  rtl: false,
  onInit: () => {},
  onChange: () => {},
});

Glide initialization:

new Glide('.glide', {
  type: 'carousel',
  startAt: 0,
  perView: 3,
  focusAt: 'center',
  gap: 40,
  autoplay: 4000,
  animationDuration: 800,
  animationTimingFunc: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
  breakpoints: {
    1200: { perView: 2 },
    800: { perView: 1 }
  }
}).mount();

Siema offers a simpler configuration with fewer options, while Glide provides more advanced features and customization out of the box. Glide includes built-in responsive breakpoints and more animation options, whereas Siema focuses on providing a lightweight, basic slider functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

glide.js

Glide.js is a dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more

Build Status

What can convince you:

  • Dependency-free. Everything included, ready for action.
  • Lightweight. Only ~23kb (~7kb gzipped) with every functionality on board.
  • Modular. Remove unused modules and drop script weight even more.
  • Extendable. Plug-in your own modules with additional functionalities.
  • Bundlers ready. Using Rollup or Webpack? We have your back.

Documentation

Visit glidejs.com for documentation.

Looking for old documentation? Wiki contains archived documentation of Glide.js in version ^2.0.0.

Donation

Glide.js is an open source project licensed under the MIT license. It's completely free to use. However, it would be great if you buy me a cup of coffee once in a while to keep me awake :)

Getting started

Pull-in a latest version with NPM ...

npm install @glidejs/glide

... provide <link> to the required core stylesheet. You can also optionally add an included theme stylesheet ...

<!-- Required Core stylesheet -->
<link rel="stylesheet" href="node_modules/@glidejs/glide/dist/css/glide.core.min.css">

<!-- Optional Theme stylesheet -->
<link rel="stylesheet" href="node_modules/@glidejs/glide/dist/css/glide.theme.min.css">

... then, prepare a little bit of necessary markup ...

<div class="glide">
  <div data-glide-el="track" class="glide__track">
    <ul class="glide__slides">
      <li class="glide__slide"></li>
      <li class="glide__slide"></li>
      <li class="glide__slide"></li>
    </ul>
  </div>
</div>

... and finally, initialize and mount a Glide.

import Glide from '@glidejs/glide'

new Glide('.glide').mount()

Need a few selected modules? Import and mount only what you need.

import Glide, { Controls, Breakpoints } from '@glidejs/glide/dist/glide.modular.esm'

new Glide('.glide').mount({ Controls, Breakpoints })

Contributing

The issue channel is especially for improvement proposals and bug reporting. If you have implementing problems, please write on StackOverflow with glidejs tag.

Browser Support

  • IE 11+
  • Edge
  • Chrome 10+
  • Firefox 10+
  • Opera 15+
  • Safari 5.1+
  • Safari iOS 9+

Building

Build using NPM scripts. The following scripts are available:

  • build:css - Outputs CSS files from SASS files.
  • build:js - Outputs all destination variants of the script.
  • build - Comprehensively builds the entire library.
  • test - Runs complete test suite.
  • lint - Lints library JavaScript files.

Credits

License

Copyright (c) 2014-present, Jędrzej Chałubek. Licensed under the terms of the MIT License.

NPM DownloadsLast 30 Days