Open Dima-Dim opened 4 years ago
@Dima-Dim
Thanks for this suggestion but could you also provide the following?
Suppose we have the following initial data:
const data = [
{
id: 0,
name: "Simple Long Text",
},
{
id: 1,
name: "Text",
},
];
получаем вот такой вариант:
these are two slides 172px wide. Yes, some stylization has been applied here, but it does not affect the mechanism for forming the width of the carousel elements.
I would like to be able to get something like this:
In this case, these are 124px and 38px slides.
Now we achieve this with:
const resetStaticWidthForItems = (node: HTMLUListElement) => {
const items = node.querySelectorAll("li");
items.forEach((item) => {
item.setAttribute("style", "width: auto;");
})
};
Thanks @Dima-Dim
Are you able to provide code applicable in the clickable docs?
This fix does not work! When the carousel is set to infinite and you change the width of the carousel items the logic that moves the carousel fails. For me it continues to jump back to the end of the carousel when it is about to complete a full iteration.
If you use a carousel for texts, then the same width for the slides may not be optimal and it may be convenient to be able to set the max-width of the slide, but the widths themselves should be adjusted to the width of the content.