A lightweight, zero-dependency JavaScript slider built on native CSS Grid. Responsive, accessible, and easy to theme.
Pure vanilla JavaScript — no framework or build step required.
Track sizing driven entirely by CSS with simple custom properties.
Supports both media queries and modern container queries.
Keyboard navigation, ARIA labels, and semantic HTML out of the box.
Two CSS variables control column count and gap at each breakpoint.
Run as many independent sliders as you need on a single page.
git clone https://github.com/foxshack/gridslider.git
<link rel="stylesheet" href="path/to/theme.css">
<script type="module" src="path/to/index.js"></script>
<div data-glider class="glider-mq">
<div data-glider-grid>
<div data-glider-item>Item 1</div>
<div data-glider-item>Item 2</div>
<div data-glider-item>Item 3</div>
</div>
<button data-glider-nav="prev">←</button>
<button data-glider-nav="next">→</button>
<div data-glider-pager></div>
</div>
import initGlider from './index.js';
initGlider();
/* show 4 columns from 768 px, 6 from 1200 px */
:root {
--gs-visible-cols-md: 4;
--gs-visible-gaps-md: 3;
--gs-visible-cols-xl: 6;
--gs-visible-gaps-xl: 5;
}
Explore live examples including navigation buttons, container queries, and auto-hiding pager.
Open the demo →