An Accessible Touch-enabled Slider Web Component | fg-carousel

fg-carousel Slider – A simple & modern slider web component to create versatile, accessible, touch-enabled picture carousels utilizing CSS scroll snap, Custom Element, and Intersection Observer API.

Must Read: A Simple Infinite Image Carousel Using Pure Javascript

How to make use of it:

1. Import the fg-carousel’s library.

<!-- Intersection Observer Polyfill -->
<script src="./lib/intersection-observer.js"></script>
<!-- Custom Elements Polyfill -->
<script src="./lib/document-register-element.js"></script>
<!-- Core Module -->
<script type="module" src="./src/fg-carousel.js"></script>
<!-- For IE 11 -->
<script src="./es5/fg-carousel.js" defer nomodule></script>
<!-- Stylesheet -->
<link rel="stylesheet" href="src/fg-carousel.css" />

2. Add photos to the carousel element.

<fg-carousel>
  <div class="carousel_pane_crop">
    <div class="carousel_pane">
      <div class="carousel_items">
        <div class="carousel_item" id="img-1">
          // Add Image Here
        </div>
        <div class="carousel_item" id="img-2">
          // Add Image Here
        </div>
        <div class="carousel_item" id="img-3">
          // Add Image Here
        </div>
      </div>
    </div>
  </div>
</fg-carousel>

3. Add thumbnail navigation to the bottom of the carousel.

<div class="carousel_nav">
  <a href="#img-1"> // Add Image Here </a>
  <a href="#img-2"> // Add Image Here> </a>
  <a href="#img-3"> // Add Image Here </a>
</div>

4. Add navigation arrows to the carousel.

<fg-carousel  data-carousel-nextprev>
  <div class="carousel_pane_crop">
    <div class="carousel_pane">
      <div class="carousel_items">
        <div class="carousel_item">
          // Add Image Here
        </div>
        <div class="carousel_item">
          // Add Image Here
        </div>
        <div class="carousel_item">
          // Add Image Here
        </div>
      </div>
    </div>
  </div>
</fg-carousel>

5. Enable autoplay on the carousel.

<fg-carousel data-carousel-autoplay="5000">
  <div class="carousel_pane_crop">
    <div class="carousel_pane">
      <div class="carousel_items">
        <div class="carousel_item">
          // Add Image Here
        </div>
        <div class="carousel_item">
          // Add Image Here
        </div>
        <div class="carousel_item">
          // Add Image Here
        </div>
      </div>
    </div>
  </div>
</fg-carousel>

6. Enable infinite looping on the carousel.

<fg-carousel data-carousel-loop>
  <div class="carousel_pane_crop">
    <div class="carousel_pane">
      <div class="carousel_items">
        <div class="carousel_item">
          // Add Image Here
        </div>
        <div class="carousel_item">
          // Add Image Here
        </div>
        <div class="carousel_item">
          // Add Image Here
        </div>
      </div>
    </div>
  </div>
</fg-carousel>

7. Allows a number of carousel items per view.

@media (min-width: 30em){
  .carousel_item {
    width: 50%;
  }
  .carousel_pane {
    scroll-snap-points-x: repeat(50%);
  }
}
@media (min-width: 50em){
  .carousel_item {
    width: 33.333%;
  }
  .carousel_pane {
    scroll-snap-points-x: repeat(33.33333%);
  }
}

See Demo And Download

Slider-fg-carousel

Official Website(filamentgroup): Click Here

This superior jQuery/javascript plugin is developed by filamentgroup. For extra Advanced usage, please go to the official website.

Related Posts

drag-drop-file-5x5-jq-uploader

Responsive Drag and Drop File Uploader/Download Plugin | 5x5_jq_uploader

5x5_jq_uploader plugin can be used to instantly create a drop file area and file queue with a little bit of preparation. Bootstrap is used for responsive planning…

Bootstrap-Dark-Mode

Stylesheet For Implementing Dark Mode with Bootstrap

Bootstrap Dark Mode provides a style sheet and two texts that allow you to implement Dark Mode on your website. Initially loaded based on user preferences, can…

responsive-navigation-menu

Multi-purpose Navigation Menu for Javascript Library | jQuery Corenav

coreNavigation is a multipurpose navigation menu for a jquery based javascript library, comes with more style, and is easy to integrate. 11 Default Menu 2 Responsive Navigation…

Simple-Multi-Select-Dropdown-Pure-Vanilla-Javascript

Simple Multi-Select Dropdown Pure Vanilla Javascript | multiSelect.js

MultiSelect.js is a simple, clean, and progressive JavaScript library designed for easy integration with any type of project or system. The design was heavily influenced by the…

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

how-to-create-popup-in-html-with-css

How To Create A Popup in HTML with CSS

How to create popup in html with css – Popup without JavaScript is an elegant pop-up panel component with an animated scale, written in CSS. Have you…