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.
How to disable the auto scroll when I click on slide thumbnails?
How to disable the auto scroll when I click on slide thumbnails?
Comments
Comment #1
okokokok CreditAttribution: okokokok commentedWhere does this slide stuff come from?
Comment #2
okokokok CreditAttribution: okokokok commentedLooks like there's no setting for this.
I simply uncommented the two lines in
galleryformatter.module
with(I find it odd this "feature" was added without a related setting.)
Comment #3
okokokok CreditAttribution: okokokok commentedAh oops. Merely uncommenting the hash_id stuff as above makes the main image disappear!
Comment #4
okokokok CreditAttribution: okokokok commentedWe have this module on http://teakmoebel.com/
If someone clicks on a product thumb on the front page they will end up seeing the same thumb at the top of the screen, but we want the title to be visible. And we don't mind if our header is visible as well.
Comment #5
Manuel Garcia CreditAttribution: Manuel Garcia commentedThe "scrolling" is not a feature of galleryformatter at all.
What happens is when some js updates window.location.hash (adds #slide-3-field_image-467 to the location bar of your browser), then the browser by default scrolls that DOM element with that ID into view.
However, I'm pretty sure the problem is not with galleryformatter, since we don't update window.location.hash (see the @FIXME comment on line 65 of galleryformatter.js).
So something else is probably triggering that...
Comment #6
okokokok CreditAttribution: okokokok commentedI'm starting to think that the code at http://cgit.drupalcode.org/galleryformatter/tree/theme/galleryformatter.... somehow does set location.hash if it wasn't set before.
If I disable the code no hash appears (but the image doesn't appear either).
Comment #7
okokokok CreditAttribution: okokokok commentedOk, it's not that. I turned the event function with this and it's still setting the hash location somewhere (else).
Comment #8
okokokok CreditAttribution: okokokok commentedAh I think I found it now:
And gallery formatter is setting the hash of a href in galleryformatter.tpl.php:
<a href="#<?php print $data['hash_id']; ?>"><?php print $data['image']; ?>
Comment #9
Manuel Garcia CreditAttribution: Manuel Garcia commentedYes, that is triggered on load, but the click event does NOT change
window.location.hash
. You can easily test this on a clean Drupal install.Comment #10
donquixote CreditAttribution: donquixote commentedI found what is causing this. (I am working on the same project)
We are using a custom theme based on the Drupal Bootstrap theme, and the bootstrap.js has one behavior called "bootstrapAnchors".
If I disable this behavior with a
return;
statement, the problem is gone.See also #2153689: Smooth ScrollTo is a little aggressive, preventing slideshow to work properly in the bootstrap queue.
The anchor stuff can be switched off in the bootstrap theme settings, which we are going to do.
Comment #11
donquixote CreditAttribution: donquixote commentedI think if anything this needs to be fixed in Bootstrap theme, which is just a bit too aggressive.
Comment #12
Manuel Garcia CreditAttribution: Manuel Garcia commentedThanks for the update @donquixote, glad you managed to find where the problem was coming from.
@ironmanwk are you using the bootstrap theme also?