Center aligning dynamic slides within carousel (BXSlider)
NickName:LeeTee Ask DateTime:2017-01-20T20:13:41

Center aligning dynamic slides within carousel (BXSlider)

I am struggling to get the slides to center align within the wrapper. My carousel can have a dynamic number of slides and therefore may not fill the width of the wrapper. They are aligned left by default but I need them center aligned. Can anyone help?

I have created a JSFiddle to display my issue: http://jsfiddle.net/ysuf1u1p/2/

.bxslider-inner {
    display: inline-block;
    float:none !important;
    margin: 0 auto;
}

.bx-wrapper {
    max-width: 460px!important;
    text-align:center;
}

<ul class="bxslider">
  <li class="bxslider-inner"><div style="width:80px; height:80px; background:#CCC; padding:5px;">1</div></li>
 <li class="bxslider-inner"><div style="width:80px; height:80px; background:#F5F5F5; padding:5px;">2</div></li>
    <li class="bxslider-inner"><div style="width:80px; height:80px; background:#F5F5F5; padding:5px;">3</div></li>
</ul>

<script>
jQuery(document).ready(function(){
    jQuery('.bxslider').bxSlider({
    mode: 'horizontal',
    speed: 500,
    slideMargin:10,
    infiniteLoop: false,
    pager: false,
    controls: true,
    slideWidth: 80,
    minSlides: 1,
    maxSlides: 5,
    moveSlides: 1       
      });
    });

</script>

Copyright Notice:Content Author:「LeeTee」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41763448/center-aligning-dynamic-slides-within-carousel-bxslider

More about “Center aligning dynamic slides within carousel (BXSlider)” related questions

Center aligning dynamic slides within carousel (BXSlider)

I am struggling to get the slides to center align within the wrapper. My carousel can have a dynamic number of slides and therefore may not fill the width of the wrapper. They are aligned left by d...

Show Detail

Vertically center-align div in BxSlider Carousel

I'm using bxslider script to build a carousel. I can do everything fine, I'm just having a problem trying to align to center the slides vertically, as they don't have the same height. I've tried nu...

Show Detail

bxSlider carousel showing only 1 slide

I'm tyring to reproduce a carousel kinda like that one : http://bxslider.com/examples/carousel-dynamic-number-slides The only difference being that mine would include html content rather than simple

Show Detail

how to center slides in bxslider, so no slides are cropped

Please take a look at the current site I'm developing: http://debourg-dev.ch/eliterent/ For the bottom brand logo slider, I am using bxslider. I'm wondering if there is a way to center the slides (...

Show Detail

BxSlider Carousel - Changing one by one

I am using BxSlider Carousel in my project. Here is the link from bxslider; http://bxslider.com/examples/carousel-demystified I am using the vertical one. What I want to adjust and achieve there ...

Show Detail

In bxslider, how to set infiniteloop: false AND the # of slides = # of bullets?

Adding "infiniteLoop: false" changes the number of bullets under a carousel. Working from this bxslider example (with 10 slides and 10 bullets): http://bxslider.com/examples/carousel-demystified#

Show Detail

CSS - display:inline breaks on IE - center aligning elements within jquery carousel

I had an issue getting my elements within a carousel to be center aligned if the number of elements did not fill the wrapper. I managed to get this working by adding display:inline to the wrapper ...

Show Detail

How to reload Javascript on browser resize? BXslider carousel

I am using BXslider carousel and want to display specific number of static slides in carousel as per screen width. I tried to use jQuery resize(), but it is not working properly. You can see working

Show Detail

Center slides in bxslider

I have a bxslider which is full width of the page when theyre is not enough slides to make it slide i want the slides to center inside the wrapper, i have tried using text-align center and margins ...

Show Detail

jquery bxslider carousel issue when resize

i have a problem with bxslider carousel. im trying to make responsive web and im using resize method in js. im trying to make slider has 2 slides and then 1 slide by shrinking window width. But,,,...

Show Detail