@@ -20,39 +20,42 @@ const handleResize = () => {
20
20
const isDesktop = window . matchMedia ( '(min-width: 1201px)' ) . matches ;
21
21
const isTablet = ! isDesktop && ! isMobile ;
22
22
23
- const slideContentInner = Array . from (
24
- document . querySelectorAll ( '.c-pega-wwo__content--inner' ) ,
25
- ) ;
26
23
const container = document . querySelector ( '.c-pega-wwo__wrapper' ) ;
27
24
28
- const activeSlideString = container . classList . contains (
29
- 'c-pega-wwo__active-wo' ,
30
- )
31
- ? 'wo'
32
- : 'w' ;
33
- triggerAnimateInOnInOnlyContent ( activeSlideString ) ;
34
-
35
- if ( isTablet || isMobile ) {
36
- const toggleRegionHeight = window . getComputedStyle (
37
- document . querySelector ( '.c-pega-wwo__title-and-toggle--wrapper' ) ,
38
- ) . height ;
39
-
40
- const contents = document . querySelectorAll ( '.c-pega-wwo__content' ) ;
41
- let greatestHeight = 0 ;
42
- contents . forEach ( el => {
43
- const height = parseInt ( window . getComputedStyle ( el ) . height , 10 ) ;
44
- greatestHeight = height > greatestHeight ? height : greatestHeight ;
45
- } ) ;
46
- container . style . height = `${ greatestHeight +
47
- parseInt ( toggleRegionHeight , 10 ) } px`;
48
- slideContentInner . forEach ( el => {
49
- el . style . paddingTop = toggleRegionHeight ;
50
- } ) ;
51
- } else {
52
- slideContentInner . forEach ( el => {
53
- el . style . paddingTop = 0 ;
54
- } ) ;
55
- container . style . height = '100%' ;
25
+ if ( container ) {
26
+ const slideContentInner = Array . from (
27
+ document . querySelectorAll ( '.c-pega-wwo__content--inner' ) ,
28
+ ) ;
29
+
30
+ const activeSlideString = container . classList . contains (
31
+ 'c-pega-wwo__active-wo' ,
32
+ )
33
+ ? 'wo'
34
+ : 'w' ;
35
+ triggerAnimateInOnInOnlyContent ( activeSlideString ) ;
36
+
37
+ if ( isTablet || isMobile ) {
38
+ const toggleRegionHeight = window . getComputedStyle (
39
+ document . querySelector ( '.c-pega-wwo__title-and-toggle--wrapper' ) ,
40
+ ) . height ;
41
+
42
+ const contents = document . querySelectorAll ( '.c-pega-wwo__content' ) ;
43
+ let greatestHeight = 0 ;
44
+ contents . forEach ( el => {
45
+ const height = parseInt ( window . getComputedStyle ( el ) . height , 10 ) ;
46
+ greatestHeight = height > greatestHeight ? height : greatestHeight ;
47
+ } ) ;
48
+ container . style . height = `${ greatestHeight +
49
+ parseInt ( toggleRegionHeight , 10 ) } px`;
50
+ slideContentInner . forEach ( el => {
51
+ el . style . paddingTop = toggleRegionHeight ;
52
+ } ) ;
53
+ } else {
54
+ slideContentInner . forEach ( el => {
55
+ el . style . paddingTop = 0 ;
56
+ } ) ;
57
+ container . style . height = '100%' ;
58
+ }
56
59
}
57
60
} ;
58
61
0 commit comments