title: How to use same swiper in tabs?
body: <p>I'm using <a href="http://idangero.us/swiper/" rel="nofollow noreferrer">Swiper Slider</a> in tabs, but it doesn't work in tab "two".<br>
  What's going wrong?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var swiper = new Swiper('.swiper-container', {
    navigation: {
      nextEl: '.swiper-button-next',
      prevEl: '.swiper-button-prev',
    },
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html,
  body {
    position: relative;
    height: 100%
  }
  
  body {
    background: #eee;
    font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #000;
    margin: 0;
    padding: 0
  }
  
  .tabs {
    display: flex;
    flex-wrap: wrap
  }
  
  .tabs label {
    width: 50%;
    order: 1;
    display: block;
    padding: 10px 0;
    text-align: center;
    cursor: pointer;
    background: #838487;
    font-weight: 700;
    transition: background ease .2s
  }
  
  .tabs .tab {
    order: 99;
    flex-grow: 1;
    width: 100%;
    display: none;
    padding: 1rem;
    background: #92B6D5
  }
  
  .tabs input[type="radio"] {
    display: none
  }
  
  .tabs input[type="radio"]:checked+label {
    background: #92B6D5
  }
  
  .tabs input[type="radio"]:checked+label+.tab {
    display: block
  }
  
  .swiper-container {
    width: 50%;
    height: 300px
  }
  
  .swiper-slide {
    text-align: center;
    font-size: 18px;
    background: #fff;
    display: -webkit-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    -webkit-align-items: center;
    align-items: center
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/js/swiper.min.js"&gt;&lt;/script&gt;
  &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/css/swiper.min.css" rel="stylesheet" /&gt;
  
  &lt;div class="tabs"&gt;
    &lt;input type="radio" name="tabs" id="tabone" checked="checked"&gt;
    &lt;label for="tabone"&gt;Tab One&lt;/label&gt;
    &lt;div class="tab"&gt;
      &lt;!-- Swiper --&gt;
      &lt;div class="swiper-container swiper-container-initialized swiper-container-horizontal"&gt;
        &lt;div class="swiper-wrapper"&gt;
          &lt;div class="swiper-slide"&gt;Slide 1&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 2&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 3&lt;/div&gt;
          &lt;div class="swiper-slide swiper-slide-prev"&gt;Slide 4&lt;/div&gt;
          &lt;div class="swiper-slide swiper-slide-active"&gt;Slide 5&lt;/div&gt;
          &lt;div class="swiper-slide swiper-slide-next" style="width: 575px;"&gt;Slide 6&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 7&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 8&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 9&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 10&lt;/div&gt;
        &lt;/div&gt;
        &lt;!-- Add Arrows --&gt;
        &lt;div class="swiper-button-next" tabindex="0" role="button" aria-label="Next slide" aria-disabled="false"&gt;&lt;/div&gt;
        &lt;div class="swiper-button-prev" tabindex="0" role="button" aria-label="Previous slide" aria-disabled="false"&gt;&lt;/div&gt;
        &lt;span class="swiper-notification" aria-live="assertive" aria-atomic="true"&gt;&lt;/span&gt;&lt;/div&gt;
    &lt;/div&gt;
  
    &lt;input type="radio" name="tabs" id="tabtwo"&gt;
    &lt;label for="tabtwo"&gt;Tab Two&lt;/label&gt;
    &lt;div class="tab"&gt;
      &lt;!-- Swiper --&gt;
      &lt;div class="swiper-container swiper-container-initialized swiper-container-horizontal"&gt;
        &lt;div class="swiper-wrapper"&gt;
          &lt;div class="swiper-slide swiper-slide-active"&gt;Slide 1&lt;/div&gt;
          &lt;div class="swiper-slide swiper-slide-next"&gt;Slide 2&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 3&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 4&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 5&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 6&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 7&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 8&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 9&lt;/div&gt;
          &lt;div class="swiper-slide"&gt;Slide 10&lt;/div&gt;
        &lt;/div&gt;
        &lt;!-- Add Arrows --&gt;
        &lt;div class="swiper-button-next" tabindex="0" role="button" aria-label="Next slide" aria-disabled="false"&gt;&lt;/div&gt;
        &lt;div class="swiper-button-prev swiper-button-disabled" tabindex="0" role="button" aria-label="Previous slide" aria-disabled="true"&gt;&lt;/div&gt;
        &lt;span class="swiper-notification" aria-live="assertive" aria-atomic="true"&gt;&lt;/span&gt;&lt;/div&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://mikij1029.github.io/web/020-navigation.html" rel="nofollow noreferrer">Link to website</a></p>