@@ -2,36 +2,35 @@ let currImgIndex = -1;
22let timerCarousel ;
33let carouselImgs ;
44
5-
65function advanceCarousel ( ) {
7- carouselImgs [ currImgIndex ] . style . display = "none" ;
8- currImgIndex = ++ currImgIndex % carouselImgs . length ;
9- carouselImgs [ currImgIndex ] . style . display = "block" ;
6+ carouselImgs [ currImgIndex ] . style . display = "none" ;
7+ currImgIndex = ++ currImgIndex % carouselImgs . length ;
8+ carouselImgs [ currImgIndex ] . style . display = "block" ;
109}
1110
1211function onClickHandlerAdvance ( ) {
13- clearInterval ( timerCarousel ) ;
14- advanceCarousel ( ) ;
15- timerCarousel = setInterval ( advanceCarousel , BANNER_TIMEOUT ) ;
12+ clearInterval ( timerCarousel ) ;
13+ advanceCarousel ( ) ;
14+ timerCarousel = setInterval ( advanceCarousel , BANNER_TIMEOUT ) ;
1615}
1716
1817( function setupCarousel ( ) {
19- carouselImgs = document . getElementsByClassName ( IMGS_CLASS ) ;
20- if ( carouselImgs . length <= 0 ) { // To prevent call back on pages with no images
21- console . log ( "No Images found with class: " + IMGS_CLASS ) ;
22- return ; // Do nothing no images found
23- }
18+ carouselImgs = document . getElementsByClassName ( IMGS_CLASS ) ;
19+ if ( carouselImgs . length <= 0 ) { // To prevent call back on pages with no images
20+ console . log ( "No Images found with class: " + IMGS_CLASS ) ;
21+ return ; // Do nothing no images found
22+ }
2423
25- // Hide all images
26- for ( let i = 0 ; i < carouselImgs . length ; i ++ ) {
27- carouselImgs [ i ] . style . display = "none" ;
28- }
24+ // Hide all images
25+ for ( let i = 0 ; i < carouselImgs . length ; i ++ ) {
26+ carouselImgs [ i ] . style . display = "none" ;
27+ }
2928
30- currImgIndex = carouselImgs . length - 1 ; // Initialize last image
31- timerCarousel = setInterval ( advanceCarousel , BANNER_TIMEOUT ) ;
32- advanceCarousel ( ) ;
29+ currImgIndex = carouselImgs . length - 1 ; // Initialize last image
30+ timerCarousel = setInterval ( advanceCarousel , BANNER_TIMEOUT ) ;
31+ advanceCarousel ( ) ;
3332
34- // Set onclick handler to advance photo
35- let container = document . getElementById ( IMGS_CONTAINER_ID ) ;
36- container . onclick = onClickHandlerAdvance ;
37- } ) ( ) ;
33+ // Set onclick handler to advance photo
34+ let container = document . getElementById ( IMGS_CONTAINER_ID ) ;
35+ container . onclick = onClickHandlerAdvance ;
36+ } ) ( ) ;
0 commit comments