javascript - Slick Carousel - Container width not working -
i have started using slick carousel plugin website working on , reason, if set wrapper around targeted element slick carousel, width not honoured unless set pixels not option when need width grow size of parent element.
i using bootstrap in case helps.
html
<div class="col-md-6 col-xs-12"> <div class="group-filter"> <span class="title">group filter</span> <div class="group-slick-cell"> <div class="group-slick-wrapper"> <div class="group-slick"> <div><button class="btn btn-groups">group 1</button></div> <div><button class="btn btn-groups">group 2 more text</button></div> <div><button class="btn btn-groups">group 3</button></div> <div><button class="btn btn-groups">group 4 text</button></div> </div> </div> </div> </div>
less:
.group-filter { display: table; width: 100%; .title { display: table-cell; font-size: 16px; color: @text-color; padding: 0 5px; vertical-align: middle; width: 1%; } .group-slick-cell { display: table-cell; width: 100%; height: 31px; .group-slick-wrapper { margin-left: 17px; width: 100% .btn { margin: 0 5px; } } } }
js:
groupslick.slick({ infinite: true, dots: false, speed: 200, slidestoshow: 3, slidestoscroll: 1, variablewidth: true, centermode: true, draggable: false, accessibility: false });
here's jsfiddle of actual issue. child of parent container pushing width out 20,000px wider bootstrap should going to.
for might looking similar fix this, have created update original jsfiddle below might able out.
i changed display: table-cell
float: left
, added table-layout: fixed
wrapper element.
Comments
Post a Comment