【发布时间】:2021-12-17 10:54:58
【问题描述】:
我正在尝试使用 Swiper 和 leader-line.js 构建时间线。 我尝试将它与 Swiper 的转换功能一起使用,但它不能正常工作。 这是我的领导行代码;
const items = document.querySelectorAll(".circle");
const options = {
startSockets: ["top", "bottom", "right", "bottom", "left", "right"],
endSockets: ["top", "bottom", "top", "top", "top", "top"]
};
for(let i = 0; i < items.length - 1; i++) {
new LeaderLine(items[i], items[i + 1], {
startPlug: "behind",
endPlug: "behind",
size: 2,
dash: true,
startPlugSize: 3,
endPlugSize: 1,
startSocket: "right",
endSocket: "left",
color: "#fb8c00",
path: 'straight',
});
}
我做了一个codepen例子来说明清楚。
https://codepen.io/Xteripus/pen/yLopBNp?editors=1010
我想让线条粘在 Swiper 的容器上,这样当 swiper 元素移动时,线条也会随之移动。 提前致谢!
【问题讨论】:
标签: javascript line swiper