Hello Drupal Team,

I wasn't able to find any other reports regarding this issue, so I assume no one noticed it yet... much to my surprise I might add. Here's the thing:

The "Prev" and "Next" links of the bootstrap carousel are not doing what they're suppossed to (i.e. cycling the items) because their default click event gets overwritten by the bootstrap-anchors functionality in themes/bootstrap/js/bootstrap.js. The issue lies with this part of the code (Line 120):

$scrollableElement.on('click.bootstrap-anchors', 'a[href*="#"]:not([data-toggle],[data-target])', function(e) {
    this.scrollTo(e);
});

This basically treats any link with a hash in the "href" attribute as a page anchor and and initiates a smooth animated scroll to the referenced element. The only exception are links with the attributes "data-toggle" and "data-target". The problem: The slider navigation buttons use neither of those attributes, they use "data-slide". So in order to fix this, the code should look like this:

$scrollableElement.on('click.bootstrap-anchors', 'a[href*="#"]:not([data-toggle],[data-target],[data-slide])', function(e) {
    this.scrollTo(e);
});

I hope this finds it's way into one of the next releases as soon as possible. It is quite a big issue and I have no idea how it was possible that, apparently, it has gone unnoticed until now.

Best regards,
Stefan

Comments

CP-Admin’s picture

Title: Bootstrap Slider: Prev/Next functionality broken by bootstrap-anchors » Bootstrap Carousel: Prev/Next functionality broken by bootstrap-anchors
markhalliwell’s picture

Version: 7.x-3.x-dev » 7.x-3.0
Status: Active » Closed (duplicate)
Issue tags: -slider, -data-slide, -bootstrap-anchors
Related issues: +#2153689: Smooth ScrollTo is a little aggressive, preventing slideshow to work properly

The dev version has already fixed this.

travismark’s picture

Thanks this is the fix for the broken next/prev button! Tried it and it works

markhalliwell’s picture

The entire custom anchor JS is actually going to be removed in favor of this related issue.