darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

Hidden last item when item-width is not an integer #221

Closed HighFish87 closed 8 years ago

HighFish87 commented 8 years ago

When the item size is computed relatively, it often happens, that the item-width's are no integers. In my example the item-width was 370.328px. This causes the last element to wrap on a new line.

This can be easily fixed by remove the round-call in:

var itemSize = round(o.horizontal ? rect.width || rect.right - rect.left : rect.height || rect.bottom - rect.top);

I didn't see any bugs with this solution, but I tested not so long.

Is there any reason, why this has to be an integer number?

Cheers,

Michael

darsain commented 8 years ago

There are already 2 issues regarding slidee width calculation errors. Closing this in favor of #200.

If you have an example on jsfiddle or a similar service that isolates the issue, please post it there.