Skip to content

Commit

Permalink
Merge pull request #13 from theohbrothers/fix/gallery-only-set-active…
Browse files Browse the repository at this point in the history
…-image-while-scrolling-in-stretchx-and-stretchy-modes

Fix (gallery): Only set active image while scrolling in stretchx and stretchy modes
  • Loading branch information
leojonathanoh authored Aug 26, 2021
2 parents e49cdf6 + 2f3ec2e commit ae4bfab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions webize
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,13 @@ if [ -n "$GALLERY" ]; then
// Set element of interest while scrolling
rootElement.addEventListener("wheel", function(e) {
for (var i = images.length - 1; i >= 0; i--) {
if (images[i].parentNode.offsetTop < window.scrollY) {
console.log("Setting active image: " + i);
setActiveImageIndex(i);
break;
if (mode === "stretchx" || mode === "stretchy" ) {
for (var i = images.length - 1; i >= 0; i--) {
if (images[i].parentNode.offsetTop < window.scrollY) {
console.log("Setting active image: " + i);
setActiveImageIndex(i);
break;
}
}
}
});
Expand Down

0 comments on commit ae4bfab

Please sign in to comment.