Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center mode + Variable width + Infinite false #2431

Open
samipshresthaq opened this issue Jul 22, 2016 · 4 comments
Open

Center mode + Variable width + Infinite false #2431

samipshresthaq opened this issue Jul 22, 2016 · 4 comments

Comments

@samipshresthaq
Copy link

samipshresthaq commented Jul 22, 2016

When using center mode and infinite false with variable width you get extra white space at first slide left side and last slide right side.

Here is the link for JSFiddle.

What I want is that first slide should start from left edge whereas last slide should end at right edge without any white spaces.

@stephanieland352
Copy link

In case anyone come across this, here is the code I modified starting at line 1105 in slick.js :
if (_.options.centerMode === true && _.options.infinite === true) { _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; } else if (_.options.centerMode === true && _.options.infinite === false) { if(slideIndex >1 && slideIndex < _.slideCount - 2 ) { _.slideOffset = 0; _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); } else if (slideIndex ===1) { _.slideOffset = 0; _.slideOffset += _.slideWidth; } } else if (_.options.centerMode === true) { _.slideOffset = 0; _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); }
My slider has 5 slides, so you may need to adjust depending on how many slides you use

@tomasdev
Copy link

@leggomuhgreggo duplicate of what issue exactly?

@leggomuhgreggo
Copy link
Collaborator

Hmm, when I closed it, I was pretty sure it was a duplicate of a number of either centerMode + infinite: false issues or variableWidth issues.

I still think chances are good it's related to those, but I will reopen and assign to that topic just to make sure we're factoring for it when those issues get addressed

@thiagobrauer
Copy link

Take a look at this merge request, his solution worked for me.
#2635

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants