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="Card">
  <div class="Card-Item">カード1</div>
  <div class="Card-Item">カード2</div>
  <div class="Card-Item">カード3</div>
</div>
<!-- モーダルとスライドショー -->
<div class="ModalLayer">
  <div class="ModalLayer-Mask"></div>
  <div class="ModalLayer-Inner">
    <div class="ModalSection">
      <div class="Modal">
        <div class="Modal-Inner">
          <!-- Swiper -->
          <div class="swiper-container Modal-Inner-Card">
            <div class="swiper-wrapper Modal-Inner-Card-Wrapper">
              <!-- item -->
              <div class="swiper-slide Modal-Inner-Card-Wrapper-Slide">
                <div class="Modal-Inner-Card-Wrapper-Slide-Item">
                  <div class="Modal-Inner-Card-Wrapper-Slide-Item-Box">
                    <p class="Modal-Inner-Card-Wrapper-Slide-Item-Box-Text">カード1の内容</p>
                  </div>
                </div>
              </div>
              <!-- item -->
              <div class="swiper-slide Modal-Inner-Card-Wrapper-Slide">
                <div class="Modal-Inner-Card-Wrapper-Slide-Item">
                  <div class="Modal-Inner-Card-Wrapper-Slide-Item-Box">
                    <p class="Modal-Inner-Card-Wrapper-Slide-Item-Box-Text">カード2の内容</p>
                  </div>
                </div>
              </div>
              <!-- item -->
              <div class="swiper-slide Modal-Inner-Card-Wrapper-Slide">
                <div class="Modal-Inner-Card-Wrapper-Slide-Item">
                  <div class="Modal-Inner-Card-Wrapper-Slide-Item-Box">
                    <p class="Modal-Inner-Card-Wrapper-Slide-Item-Box-Text">カード3の内容</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="swiper-button-prev"></div>
          <div class="swiper-button-next"></div>
          <div class="Modal-Inner-Btn JS_Click_CloseModal_Trigger">
            ☓
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                /* ---------------------------- */
/* --- カードセクション --- */
/* ---------------------------- */
.Card
  margin-top 24px
  width: 100%
  display: flex
  flex-wrap: wrap
  &-Item
    width: calc((100% - 56px) / 3)
    background: #eee;
    cursor: pointer
    &:not(:nth-child(3n-2))
      margin-left: 28px
/* ---------------------------- */
/* --- ModalSection --- */
/* ---------------------------- */
.ModalLayer
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  transition: opacity 0.65s;
  pointer-events: none;
  opacity: 0;
  z-index: 10000;
.ModalLayer.isShow
  transition: opacity 0.65s;
  pointer-events: auto;
  opacity: 1;
.ModalLayer-Mask
  position: absolute;
  background: rgba(0,0,0,0.5);
  width: 100%;
  height: 100vh;
.ModalLayer-Inner
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  max-width: 600px;
  transform: translate(-50%, -50%);
 // Swiper部分
 .Modal
  &-Inner
    &-Btn
      position: absolute;
      top: -35px
      right: -35px
      width: 70px
      color: #fff
      z-index: 10
      cursor: pointer
    &-Card
      width 100%
      &-Wrapper
        display: flex;
        &-Slide
          width 100%!important
          height: auto
          &-Item
            padding-top: 50px
            padding-bottom: 50px
            width 100%
            height: 100%
            background: #059bcc
            &-Box
              position: relative
              margin-left: auto;
              margin-right: auto;
              width: 78.37%
              &-Text
                color: #fff
              
            
!

JS

              
                $(function(){

  var swiper = new Swiper('.swiper-container', {
    loop: true,
    slidesPerView: 'auto',
    centeredSlides: true,
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    }
  });

  // モーダル開く
  $('.Card-Item').on('click', function(){
    var index = $(this).index();//クリックした要素のインデックスを取得
    swiper.slideTo(index);//指定のスライドを呼び出し
    $('.ModalLayer').addClass('isShow');
  });
  $('.ModalLayer-Mask').on('click', function(){
    $('.ModalLayer').removeClass('isShow');
  });
  $('.JS_Click_CloseModal_Trigger').on('click', function(){
    $('.ModalLayer').removeClass('isShow');
  });

});

              
            
!
999px

Console