NickPiscitelli/Glider.js

Variable width of single slides

Opened this issue · 2 comments

Is it somehow possible to have a slider consisting of items with different widths? For example several images in portrait, landscape and square format?

Looking at the code it seems that all items get assigned the same width: https://github.com/NickPiscitelli/Glider.js/blob/master/glider.js#L134

But it might be easy enough to change _.itemWidth to a variable width at https://github.com/NickPiscitelli/Glider.js/blob/master/glider.js#L127

I've tried to look for events I could hook on to change this, but wasn't able to find a matching one.

FynnZW commented

That would be great. I wanted to use this as a way to add scrolling arrows to a simple horizontal scrolling container with elements of various widths. But I couldn't because itemWidth has to be a fixed value.
Something like itemWidth: 'auto' would make this library much more versatile.