Skip to content

Commit 5f663ec

Browse files
Update colorscroll.js
1 parent ebbfe91 commit 5f663ec

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

colorscroll.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Lumos ColorScroll 1.0.1
2+
* Lumos ColorScroll 1.0.2
33
* Copyright 2023 Timothy Ricks
44
* Released under the MIT License
55
* Released on: August 12, 2023
@@ -94,6 +94,7 @@ window.addEventListener("DOMContentLoaded", (event) => {
9494
$("[colorscroll-mode]").each(function () {
9595
let modeIndex = +$(this).attr("colorscroll-mode");
9696
let modeCurrent = sectionModes[`sectionMode${modeIndex}`];
97+
9798
if (modeCurrent !== undefined) {
9899
ScrollTrigger.create({
99100
trigger: $(this),
@@ -104,7 +105,13 @@ window.addEventListener("DOMContentLoaded", (event) => {
104105
gsap.matchMedia().add(`(min-width: ${breakpointSetting}px)`, () => {
105106
gsap.to("body", { ...sectionModes[`sectionMode${modeIndex}`]["mode"], duration: durationSetting, ease: easeSetting });
106107
for (let i = 1; i <= cardModeTotal; i++) {
107-
gsap.to(`[card-mode="${i}"], [class*="cm0-${i}"]`, { ...sectionModes[`sectionMode${modeIndex}`][`cardMode${i}`], duration: durationSetting, ease: easeSetting });
108+
let cards = $(`[card-mode="${i}"], [class*="cm0-${i}"]`);
109+
cards.each(function (index) {
110+
if ($(this).closest("[section-mode]:not(body), [class*='sm0']:not(body)").length) {
111+
cards = cards.not($(this));
112+
}
113+
});
114+
gsap.to(cards, { ...sectionModes[`sectionMode${modeIndex}`][`cardMode${i}`], duration: durationSetting, ease: easeSetting });
108115
}
109116
});
110117
}

0 commit comments

Comments
 (0)