Skip to content

Commit be8978c

Browse files
authored
Merge pull request #9 from dlemm/fix/Firefox-error
2 parents a8d3c8a + 5d68327 commit be8978c

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

templates/theme-default/assets/js/components/slider.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,12 @@ function init(el) {
183183

184184
function getNextSlide(direction = 1) {
185185
let next =
186-
direction > 0 ? activeSlide.nextElementSibling || activeSlide : activeSlide.previousElementSibling || activeSlide;
186+
direction > 0
187+
? activeSlide?.nextElementSibling || activeSlide
188+
: activeSlide?.previousElementSibling || activeSlide;
187189

188190
for (let i = 1; i < slidesPerGroup; i++) {
189-
next = direction > 0 ? next.nextElementSibling || next : next.previousElementSibling || next;
191+
next = direction > 0 ? next?.nextElementSibling || next : next?.previousElementSibling || next;
190192
}
191193

192194
return next;

templates/theme-default/assets/js/main.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,24 @@ if (supportsContainerQueries) {
2222
const cvObserver = new IntersectionObserver((entries, observer) => {
2323
entries.forEach((entry) => {
2424
if (entry.isIntersecting) {
25-
entry.target.attributeStyleMap.set('content-visibility', 'visible');
25+
entry.target.style.contentVisibility = 'visible';
2626
observer.unobserve(entry.target);
2727
}
2828
});
2929
});
3030

3131
const initialize = () => {
3232
Array.from(document.querySelectorAll('main img')).forEach((el) => cvObserver.observe(el));
33-
initVideo();
34-
initSlider();
33+
try {
34+
initVideo();
35+
} catch (e) {
36+
console.log(e);
37+
}
38+
try {
39+
initSlider();
40+
} catch (e) {
41+
console.log(e);
42+
}
3543
};
3644

3745
// We need to retrigger initialize in storybook so we don't have to reload the page

0 commit comments

Comments
 (0)