Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- À propos de mon matériel -->		
<section id="materiel">
  <div class="swiper-container" id="swiper-materiel">
	<div class="swiper-wrapper">
      
      <!-- CAMERA -->
      <div class="swiper-slide materiel-slide" id="camera">
        <div class="media-container">
          <img class="media" src="Images site/Camera 1.jpg" alt="Panasonic Lumix GH5" />
          <div class="nav-arrows">
            <img src="Images site/Flèche Gauche.png" class="prev-img" alt="prev" />
            <img src="Images site/Flèche Droite.png" class="next-img" alt="next" />
          </div>
        </div></div>
		  <div class="description">
        <p class="desc">Panasonic Lumix GH5<br><span>Pour toutes prises de vue grâce à<br> mes deux objectifs</span></p></div>
      
		
		<!-- DRONE -->
      <div class="swiper-slide materiel-slide" id="drone">
        <div class="media-container">
          <img class="media" src="Images site/Drone 1.jpg" alt="Drone DJI Mini 2" />
          <div class="nav-arrows">
            <img src="Images site/Flèche Gauche.png" class="prev-img" alt="prev" />
            <img src="Images site/Flèche Droite.png" class="next-img" alt="next" />
          </div>
        </div></div>
		 <div class="description">
        <p class="desc">Drone DJI Mini 2<br><span>Pour des prises de vues aériennes uniques<br>(hors agglomération)</span></p></div>
      
		
      <!-- STABILISATEUR -->
      <div class="swiper-slide materiel-slide" id="stab">
        <div class="media-container">
          <img class="media" src="Images site/Stabilisateur 1.jpg" alt="DJI Ronin-SC" />
          <div class="nav-arrows">
            <img src="Images site/Flèche Gauche.png" class="prev-img" alt="prev" />
            <img src="Images site/Flèche Droite.png" class="next-img" alt="next" />
          </div>
        </div>
		 </div>
		<div class="description">
        <p class="desc">Stabilisateur DJI Ronin-SC<br><span>Pour plus de sécurité et fluidité<br> dans les prises de vue</span></p></div>
      
      
   </div>
	      <!-- Navigation principale -->
    <div class="swiper-button-next swiper-materiel-next"></div>
    <div class="swiper-button-prev swiper-materiel-prev"></div>
    <div class="swiper-pagination swiper-materiel-pagination"></div>
  </div>
</section>

              
            
!

CSS

              
                #materiel {
  width: 100%;
  height: 100vh;
  background-image: url(Images%20site/BG.png);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden; /* Éviter les débordements */
  text-align: center;}

#materiel #swiper-materiel {
	width: 100%;
  	height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	margin-top: 5%;
}
.media-container .media {
	width: 450px;
	height: 280px;
}


#materiel #swiper-materiel .swiper-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	width: 100%;
}

#swiper-materiel .swiper-slide {
	opacity: 0.5;
	transition: transform 1s ease-in-out, opacity 1s ease-in-out;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 30%;
	height: 337px;
	margin: 0 10%;
}

#swiper-materiel .swiper-slide-active {
    transform: scale(1.3);
	opacity: 1;
}

#swiper-materiel .swiper-slide-active .media-container {
  border: 4px solid white;
  box-shadow: 0px 0px 10px rgba(255, 255, 255, 0.8);
  border-radius: 54px;
}


#swiper-materiel .nav-arrows {
  position: absolute;
  width: 100%;
  display: flex;
  justify-content: space-between;
  top: 50%;
  transform: translateY(-50%);
}


.media-container .media {
	width: 100%;
	height: 100%;
	border-radius: 54px;
}


#swiper-materiel .nav-arrows img {
  width: 50px;
  cursor: pointer;
}




#swiper-materiel .swiper-wrapper .description {
  position: absolute;
  opacity: 0;
  transform: translateY(-100px);
  transition: opacity 1s ease-in-out, transform 1s ease-in-out;
  font-family: "Colonna MT";
  font-size: 2rem;
  font-weight: lighter;
  display: block;
  width: 100%;	
}


.desc span {
  position: absolute;
  font-family: "Monotype Corsiva";
  font-size: 1.3rem;
  display: block;
  width: 100%;
}



#swiper-materiel .swiper-slide-active .desc {
  opacity: 1;
  transform: translateY(0);
}

              
            
!

JS

              
                document.addEventListener("DOMContentLoaded", function () {
    const secondswiper = new Swiper("#swiper-materiel", {
        slidesPerView: 3,
		centeredSlides: true,
        loop: true,
		spaceBetween: 1,
		watchSlidesProgress: true,
		wachSlidesVisibility: true,
        navigation: {
            nextEl: ".swiper-materiel-next",
            prevEl: ".swiper-materiel-prev",
        },
		pagination: {
            el: ".swiper-materiel-pagination",
            clickable: true,
        },
    });

    // Gestion du changement d'image à l'intérieur des slides
    document.querySelectorAll(".media-container").forEach((container) => {
        const mediaElement = container.querySelector(".media");
        const slide = container.closest(".materiel-slide");
        const id = slide.id;
        const images = {
            camera: ["Images site/Camera 1.jpg", "Images site/Camera 2.jpg", "Images site/Camera 3.png"],
			drone: ["Images site/Drone 1.jpg", "Images site/Drone 2.jpg", "Images site/Drone 3.jpg"],
            stab: ["Images site/Stabilisateur 1.jpg", "Images site/Stabilisateur 2.jpg"],
        };

        let currentIndex = 0;

        container.querySelector(".prev-img").addEventListener("click", () => {
            currentIndex = (currentIndex === 0) ? images[id].length - 1 : currentIndex - 1;
            mediaElement.src = images[id][currentIndex];
        });

        container.querySelector(".next-img").addEventListener("click", () => {
            currentIndex = (currentIndex === images[id].length - 1) ? 0 : currentIndex + 1;
            mediaElement.src = images[id][currentIndex];
        });
    });
});

              
            
!
999px

Console