Map and motion
Swiper hero
A full-screen property slider with fade, parallax, a caption that plays in, thumbnails and a progress line. Made with Swiper.
Example
Built with Swiper (MIT license). It fades between slides, moves the picture slightly for a parallax feel, plays the caption in, and runs a progress line while it waits. The thumbnails and arrows below are connected to it.
Setup
- Add Swiper's CSS and JavaScript from the CDN (already on index-swiper.html), then
assets/js/swiper-init.min.jsafter it. - Put
data-swiper="hero"on the main.swiper. Pointdata-swiper-thumbsat the thumbnail slider. - Arrows (
.sw-prev,.sw-next) and the counter (data-sw-count) are found inside the nearestdata-swiper-scope. - On the live page the slider fills the screen, changes slide every 6.5 seconds and stops when the visitor prefers reduced motion. Here it is switched off with
data-swiper-options='{"autoplay":false}'.
Classes and attributes
| Name | Purpose |
|---|---|
.sw-hero | Wrapper. Dark background. Holds the slider, the bottom panel and the progress line. |
.sw-hero-main + data-swiper="hero" | The main Swiper. Fade effect, loop, parallax, keyboard, autoplay. |
.sw-hero-slide, .sw-hero-img, .sw-hero-body | One slide: picture, then the caption. Add data-swiper-parallax-x="-8%" to the picture for the parallax. |
.sw-hero-tag, -title, -address, -info, -price, -spec, -actions | Caption parts, in the order they play in. |
.sw-hero-panel | Bottom bar with counter, arrows and thumbnails. |
.sw-hero-thumbs, .sw-hero-thumb | The thumbnail slider. The active one lifts and gets a brass border. Hidden on tablets and phones. |
.sw-hero-progress | Thin line that fills while the slide waits. |
data-swiper-options | JSON that overrides any Swiper option, for example {"speed":600}. |


