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

              
                <div class="sliderContainer">
  <div class="photoSlider">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
        <img src="https://picsum.photos/400/300.webp?random=1" alt="">
      </div>
      <div class="swiper-slide">
        <img src="https://picsum.photos/400/300.webp?random=2" alt="">
      </div>
      <div class="swiper-slide">
        <img src="https://picsum.photos/400/300.webp?random=3" alt="">
      </div>
      <div class="swiper-slide">
        <img src="https://picsum.photos/400/300.webp?random=4" alt="">
      </div>
      <div class="swiper-slide">
        <img src="https://picsum.photos/400/300.webp?random=5" alt="">
      </div>
    </div>
    <div class="swiper-pagination"></div>
    <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>
  </div>

  <div class="textSlider">
    <div class="swiper-wrapper">
      <div class="swiper-slide post">
        <div class="post-title">記事1のタイトル</div>
        <div class="post-date">2025/12/01</div>
        <div class="post-body">記事抜粋文字列を想定</div>
      </div>
      <div class="swiper-slide post">
        <div class="post-title">記事2タイトル</div>
        <div class="post-date">2025/12/02</div>
        <div class="post-body">記事抜粋文字列を想定</div>
      </div>
      <div class="swiper-slide post">
        <div class="post-title">記事3タイトル</div>
        <div class="post-date">2025/12/03</div>
        <div class="post-body">記事抜粋文字列を想定</div>
      </div>
      <div class="swiper-slide post">
        <div class="post-title">記事4タイトル</div>
        <div class="post-date">2025/12/04</div>
        <div class="post-body">記事抜粋文字列を想定</div>
      </div>
      <div class="swiper-slide post">
        <div class="post-title">記事5タイトル</div>
        <div class="post-date">2025/12/04</div>
        <div class="post-body">記事抜粋文字列を想定</div>
      </div>
    </div>
  </div>

</div>

              
            
!

CSS

              
                .sliderContainer {
  width: 600px;
  overflow-x: hidden;
  position: relative;
}

.textSlider {
  .post {
    padding: 10px;
    background-color: beige;
  }
  .post-title {
    font-weight: bold;
    font-size: larger;
  }
  .post-date {
    font-size: smaller;
    font-weight: bold;
  }
}
              
            
!

JS

              
                  const photoSlider = new Swiper(".photoSlider", {
    slidesPerView: 1.5,
    centeredSlides: true,
    spaceBetween: 30,
    loop: true,
    // ページネーション
    pagination: {
      el: ".swiper-pagination",
      clickable: true,
    },
    // 前後の矢印
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },

  });

  const textSlider = new Swiper(".textSlider", {
    slidesPerView: 1,
    centeredSlides: true,
    loop: true
  });

  photoSlider.controller.control = [textSlider];
  textSlider.controller.control = [photoSlider];

              
            
!
999px

Console