Skip to content

Commit 1cb0750

Browse files
committed
feat(with-without): fixing modal opacity fade out
1 parent 79ddae8 commit 1cb0750

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

packages/components/bolt-with-without/js/with-without.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,35 @@ import handleBlockTitleMobileAccordionClick from './accordion';
44
import handleResize from './handleResize';
55
import handleActiveRegionChange from './handleActiveRegionChange';
66

7+
// Initialize the with/without slide-toggle.
78
const toggleInputClass = '#c-pega-wwo__toggle-input';
89
SimpleSwitch.init();
910

11+
// Initialize the swiper for sliding between with and without.
1012
const wwoSwiper = new Swiper('.c-pega-wwo__swiper-container', {
1113
speed: 500,
1214
spaceBetween: 0,
1315
});
1416

17+
// Initialize the page.
1518
handleActiveRegionChange(
1619
document.querySelector(toggleInputClass).checked,
1720
wwoSwiper,
1821
true,
1922
);
23+
24+
// Wire up the toggler to the event region switcher.
2025
document
2126
.querySelector('#c-pega-wwo__toggle-input')
2227
.addEventListener('change', e => {
2328
handleActiveRegionChange(e.target.checked, wwoSwiper);
2429
});
2530

31+
// Initialize the accordion.
2632
document.querySelectorAll('.c-pega-wwo__region-blocks').forEach(el => {
2733
el.addEventListener('click', handleBlockTitleMobileAccordionClick);
2834
});
35+
36+
// Set up the resize listener which helps with some of the abs. pos. stuff.
2937
handleResize();
3038
window.addEventListener('resize', handleResize);

packages/components/bolt-with-without/with-without.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,21 @@ $pega-wwo--sm-circle-top-margin--mobile: $bolt-medium-icon-half-size - ($pega-ww
3636
}
3737

3838

39-
&__modal-bg {
39+
&__modal-bg--wrapper {
4040
position: absolute;
41+
height: 3000px;
42+
width: 100%;
4143
top: 0;
4244
left: 0;
4345
z-index: 33;
44-
width: 100vw;
46+
}
47+
48+
&__modal-bg {
49+
width: 100%;
4550
height: 100%;
51+
position: absolute;
52+
top: 0;
53+
left: 0;
4654
pointer-events: none;
4755
background-color: bolt-color(black);
4856
}

packages/components/bolt-with-without/with-without.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{# wwo stands for "with-without" #}
22
<div class="c-pega-wwo t-bolt-xdark">
33
<div class="c-pega-wwo__wrapper">
4-
<bolt-animate group="initial" out="fade-out" out-duration="6000">
5-
<div class="c-pega-wwo__modal-bg"></div>
6-
</bolt-animate>
74
<div class="c-pega-wwo__inner">
85
<div class="c-pega-wwo__title-and-toggle--wrapper">
96
<h2 class="c-pega-wwo__title">
@@ -410,5 +407,8 @@
410407
</div>
411408
</div>
412409
</div>
410+
<bolt-animate class="c-pega-wwo__modal-bg--wrapper" group="initial" out="fade-out" out-duration="2000">
411+
<div class="c-pega-wwo__modal-bg"></div>
412+
</bolt-animate>
413413
</div>
414414
</div>

0 commit comments

Comments
 (0)