Skip to main content

Devbit

Restore AJAX functionality when using Slick Slider and Layout Builder

When you are using Layout Builder, AJAX for a Slick Slider may break.

Uses new Drupal "once" Library without using JQuery (see: https://www.drupal.org/node/3158256).

          slick.on('breakpoint', function (e, _) {
            if (settings.isLayoutBuilder) {
              once.remove('ajax', '.use-ajax', _.$slideTrack[0]);
              Drupal.ajax.bindAjaxLinks(_.$slideTrack[0]);
            }
          });

Issue

When you are using Layout Builder, AJAX for a Slick Slider may break.

Prerequisites

Layout Builder with a Slick Slider and Drupal 9.X or newer are in use

Solution

Use the snippet provided to re-bind AJAX events.

Profilfoto Pascal

Pascal Crott

Lead Frontend Developer / Solution Architect / CTO / Stellv. Vorsitzender Drupal e.V.

Ihre Drupal-Website zukunftssicher machen

Wir prüfen Ihr System und zeigen, was Sie für AI, Wartung und Upgrades brauchen.