Bonjour,

j'ai récupéré un script d'effet lightbox ici : https://baptistepages.com/tutoriel/lightbox-wordpress/ (du javascript qui met à jour une classe CSS) et une galerie d'images ici : https://codepen.io/heyDante/pen/bxEYOw (que du html+css).
J'ai voulu marier les deux (afficher des images sous forme d'une galerie tout en attribuant à ces images un effet lightbox), mais y a pas d'effet lightbox. Pourquoi ?

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 <img src="https://pasdpanique.fr/wp-content/uploads/2022/11/WhatsApp-Image-2022-05-15-at-18.49.57-2.jpeg" alt="" width="100" class="image-galerie"/>
<!-- l'effet lightbox fonctionne sur une image hors de la galerie -->
  <p class="heading">CSS Gallery</p>
  <div class="gallery-image">
    <div class="img-box">
      <img src="https://pasdpanique.fr/wp-content/uploads/2022/11/WhatsApp-Image-2022-05-15-at-18.49.57-2.jpeg" alt="" width="100" class="image-galerie"/>
      <div class="transparent-box">
        <div class="caption">
          <p>Library</p>
          <p class="opacity-low">Image 1</p>
        </div>
      </div> 
    </div>
    <div class="img-box">
      <img src="https://pasdpanique.fr/wp-content/uploads/2022/11/WhatsApp-Image-2022-05-15-at-18.49.56-2.jpeg" alt="" width="100" class="image-galerie"/>
      <div class="transparent-box">
        <div class="caption">
          <p>Night Sky</p>
          <p class="opacity-low">Image 2</p>
        </div>
      </div>
    </div>
    <div class="img-box">
      <img src="https://pasdpanique.fr/wp-content/uploads/2022/11/WhatsApp-Image-2022-09-08-at-15.55.37.jpeg" alt="" width="100" class="image-galerie"/>
      <div class="transparent-box">
        <div class="caption">
          <p>Tea Talk</p>
          <p class="opacity-low">Image 3</p>
        </div>
      </div>
    </div>
 
  </div>

Code css : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* galerie_lightbox */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
 
/*body {
  font-family: Raleway;
  background-color: #202125;
}*/
 
.heading {
    text-align: center;
    font-size: 2.0em;
    letter-spacing: 1px;
    padding: 40px;
    color: white;
}
 
.gallery-image {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
 
 
.gallery-image img {
  height: 250px;
  width: 350px;
  transform: scale(1.0);
  transition: transform 0.4s ease;
}
 
.img-box {
  box-sizing: content-box;
  margin: 10px;
  height: 250px;
  width: 350px;
  overflow: hidden;
  display: inline-block;
  color: white;
  position: relative;
  background-color: white;
}
 
.caption {
  position: absolute;
  bottom: 5px;
  left: 20px;
  opacity: 0.0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
 
.transparent-box {
  height: 250px;
  width: 350px;
  background-color:rgba(0, 0, 0, 0);
  position: absolute;
  top: 0;
  left: 0;
  transition: background-color 0.3s ease;
}
 
.img-box:hover img { 
  transform: scale(1.1);
}
 
.img-box:hover .transparent-box {
  background-color:rgba(0, 0, 0, 0.5);
}
 
.img-box:hover .caption {
  transform: translateY(-20px);
  opacity: 1.0;
}
 
.img-box:hover {
  cursor: pointer;
}
 
.caption > p:nth-child(2) {
  font-size: 0.8em;
}
 
 
.opacity-low {
  opacity: 0.5;
}
/* fin galerie_lightbox */