javascript - Swiper slider - weird behaviour -


i have 2 swiper sliders in page. 1 shown , other 1 first hidden , later shown on click when whole div contains other slider shown. first 1 works , when show other behaves weird. first shows 1 image in slider, although have set both 5 images in slider. when try inspect wrong in console, slider gets 5 images should have. other works can't figure out why behaving that. how initialize them:

$(document).ready(function () {     //initialize swiper when document ready     var myswiper = new swiper ('.drawer', {       // optional parameters       direction: 'horizontal',       loop: false,       nextbutton: '.next',       prevbutton: '.previous',       slidesperview: 5,       loopedslides: 1,       simulatetouch: false     })      var myswiper = new swiper ('.itemdetail', {       // optional parameters       direction: 'horizontal',       loop: false,       nextbutton: '.next',       prevbutton: '.previous',       slidesperview: 5,       loopedslides: 1,       simulatetouch: false     })   }); 

this html, haven't written full html hope picture:

<div id="main-section">       <top-bar></top-bar>        <header></header>        <!-- first swiper slider -->       <swiper-slider></swiper-slider>      </div>     <!-- hidden div shown on click -->     <div id="drawer">       <div id="item-detail">       </div>       <div id="item-detail-slider">          <!-- second swiper slider -->       <swiper-slider></swiper-slider>        </div>     </div> 

i haven't written css them:

#drawer {   z-index: 5;   position: absolute;   height: 100vh;   width: 100%;   background-color: $charcoal;   display: none; }  #item-detail-carousel {   margin-top: 30px; }  .swiper-container{   text-align: center;   z-index: 0; }  .item-detail {   background-color: $white;   color: $black;   padding-top: $global-padding;   padding-bottom: $global-padding;   height: 700px;   width: 100%;    .item-hero {     position: relative;     width: 510px;      img {       max-width: 100%;       max-height: 100%;     }      .item-preview-nav {       background-color: #fff;       width: 200px;       position: absolute;       top: 200px;       right: 0;       text-align: center;       padding: 15px;        .right-arrow, .left-arrow {         position: relative;         height: 50%;       }        img {         width: 35px;         position: relative;         top: 33%;       }     }   }    .item-title {     border-top: 1px solid $black;     border-bottom: 1px solid $black;     position: relative;     padding-left: 0;     margin-left: 15px;      &:before {       content: '';       display: block;       position: absolute;       width: 60%;       top: -1px;       left: 0;       border: 1px solid $white;     }      &:after {       content: '';       display: block;       position: absolute;       width: 60%;       top: 100%;       right: 0;       border: 1px solid $white;     }    } } 


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -