Slider Framework

Renato Corluka
September 19, 2024

The Slider Framework is a wrapper code for the Breakdance Builder that allows users to easily create and customize responsive sliders using the Swiper.js library. It integrates seamlessly, offering extensive options for layout, navigation, and effects, event for making highly customizable slider creation simple and flexible even for non-developers.

For developers we are providing code examples how you could use full Swiper.js API and connect it to Slider element.

Getting Started

Slider Framework Architecture

It is important to understand following terms:

  • Carousel
  • Main Slider (master)
  • Components
  • Thumbnail slider (slave)
  • Connected Sliders (slave)

1. Carousel

Special div which is uses as reference for all of the components. If you put components outside this div, they won’t work.

2. Main Slider

Inside Carousel we could have multiple sliders in some configuration. Only one can act as master and other are slave sliders. This is important because master has bi-directional event connection to slave sliders, and slave sliders have uni-directional connection to Main slider. This slider has data-swiper=”main”custom attribute. If you have more than one slider with this attribute, the first slider in DOM will become master. All custom components needs to be inside Carousel and they will show progress data, and controls for the Main Slider.

If you add slave sliders, you should keep in mind that they should have same number of the slides as the Main or controls will correspond just to Main slider data and other slave sliders could show irrelevant content.

3. Components

Components are special block which are acting as custom controls for Main Slider. Some of them include functions like:

  • Prev/Next navigation
  • Play/Pause controls for autoplay
  • Bullet navigation
  • Fractional pagination
  • Active teleport
  • or could be combined in hybrid when placed in another div like fraction + bullet

4. Thumbnail slider

This slider functions as a slave slider. The content within this slider cannot be manually controlled; instead, it automatically extracts segments of content from the main slide. By setting data-swiper-thumbnail=”true” the content will be transferred into a thumbnail. The fallback option is a complete copy of the entire slide.

From a UX/A11Y perspective, this serves as a replacement for bullet or numbered navigation. Therefore, refrain from using those if you are already utilizing thumbnails.

5. Connected sliders

If you insert an additional slider within the Carousel div, it will function as a connected slider. Please ensure that it does not possess the data-swiper=”main” attribute, as there should only be one master slide. In the event of having two master sliders, the initial one will serve as the master, while the subsequent slider will act as the slave.

Components

We have different components which will work with Main slider based

Advanced Slider Setup

Setup docs for Advanced Slider

Dynamic Slider Setup

Setup docs for Dynamic Slider

Component and Magics

Components overview

Here we go navigation docs

Magic attributes

Magic attributes

Magics within the Slider Framework are unique custom attributes that transform Breakdance elements into Slider functionalities. These include displaying the number of the current slide, the total count of all slides, an autoplay countdown, and features such as pausing and playing autoplay.

AttributeElementDescription
data-swiper=”currentSlideNum”TextThis magic attribute will convert any text element to show current slide number on any text element.
data-swiper=”countSlideNum”TextThis magic attribute will convert any text element to show total slide number.
data-swiper-autoplay=”countdown”TextThis magic attribute will convert any text element to show autoplay slide time left. It will count down each second.
data-swiper=”stop”ButtonThis magic attribute will convert any button element to act as autoplay pause button.
data-swiper=”start”ButtonThis magic attribute will convert any button element to act as autoplay play button.

Events

Accessibility

Overview – todo

dasd

UX Guidlines

0. Avoid sliders

Sliders are notoriously bad for UX and A11Y. If you could use alternative design, please consider this. If you really want or need to use them please take points below to make it less sucking UX for users.

1. Use bigger dots, or even thumbnails

Usually slider dots are small and hard to click. Clickable area should be at least 24×24 pixels.

2. Alternatives to dots navigation

As alternative approach you could use thumbnail component for navigation instead just dots. Dots don’t provide much information. Also you could use number page navigation instead of dots (bullets) which would at least give more clue about slide numbers.

3. Use only one pagination pattern

Within Slide Framework there are many pagination patterns (bullets-dots, numbers, fraction, and thumbnail). We recommend usage of only one pattern as using dots and thumbnails would make usage of two element with same purpose and lead to harder navigation. Fraction pagination is only exception because it does not offer navigation option, rather just visual indication.

4. Avoid autoplay

Autoplay/autorotation sliders are notoriously hard to use avoid them if you can. If you need autoplay please consider this list:

  • Autoplay duration should be at least 5-7s to give users enough time
  • Pause button is must, and should be placed above slider in HTML order, if you need it at another position use CSS. Before entering autorotation slider, user should have option to pause it for easier navigation.
  • Place next/previous arrows below slider at mobile because this way user interacting with slider will not cover slides by hand in order to navigate. Tip: You could use two sets of elements, and display: none to hide desktop arrows on mobile, and show mobile ones below at smaller screens
  • Pause on interaction – when user hovers or interacts with slider, you should pause autoplay as probably he wants to interact and autoplay could move desired content to interact off visible portion of the screen
Autoplay

Autoplay/autorotation sliders are notoriously hard to use avoid them if you can. If you need autoplay please consider this list:

Pause on interaction – when user hovers or interacts with slider, you should pause autoplay as probably he wants to interact and autoplay could move desired content to interact off visible portion of the screen

Autoplay duration should be at least 5-7s to give users enough time

Pause button is must, and should be placed above slider in HTML order, if you need it at another position use CSS. Before entering autorotation slider, user should have option to pause it for easier navigation.

Place next/previous arrows below slider at mobile because this way user interacting with slider will not cover slides by hand in order to navigate. Tip: You could use two sets of elements, and display: none to hide desktop arrows on mobile, and show mobile ones below at smaller screens

Bullet navigation – todo

dasd

Pause/Play Controls – todo

dasd

Previous/Next Controls – todo

dasd

Examples

Autoplay
const scope = document.querySelector('.breakdance .bde-rich-text-393-105').previousElementSibling;
const swiper = scope.querySelector('.swiper').swiper;
swiper.params.autoplay.delay = 1000;
swiper.params.autoplay.reverseDirection = true;
swiper.autoplay.start();
    Headspin Logo
    1.2.3
    Built with
    Breakdance
    and
    Headspinui
    @ 2024 HeadspinUI. All rights reserved.