Direkt zum Inhalt

Devbits

Kleine Code-Schnipsel aus unserem Alltag mit Drupal, PHP und DevOps: Problem, Lösung, Code.

13.04.2026 | Pascal Crott

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.