Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to figure out how to run code based on an event handler. Here's what I have:
(function ($, Drupal, window, document, undefined) {
$(window).on("backstretch.before", function (e, instance, index) {
// If we wanted to stop the slideshow after it reached the end
if (index === instance.images.length - 1) {
instance.pause();
};
});})(jQuery, Drupal, this, this.document);
However, somehow the event doesn't fire. Is there something I'm doing wrong? Thanks in Advance.