gpt4 book ai didi

reactjs - 如何使用reactjs从左向右滚动我的图像?

转载 作者:行者123 更新时间:2023-12-03 14:29:51 25 4
gpt4 key购买 nike

I want to scroll an image from left to right and right to left. This means when the image did finish scroll left to right then automatically right to left scrolling is enabled and then repeats it. I want only show 4 images first and rest are scroll

这是我的代码:-

export default class Gallery extends React.Component {
render() {
return (
<div >
<a >&#10094;</a>
<div >
<div >1</div>
<div >2</div>
<div >3</div>
<div >4</div>
<div >5</div>
<div >6</div>
<div >7</div>
<div >8</div>
<div >9</div>
<div >10</div>
</div>
<a >&#10095;</a>
</div>
)
}
}

这是图片:- i want only 4 box is showing and rest are scrolling

最佳答案

如果您想要正确的解决方案,该解决方案在整个浏览器中具有共同的行为以及“滚动时应该有过渡”、“自动播放”等,那么你应该使用react-slick,它可以提供许多开箱即用的选项

https://www.npmjs.com/package/react-slick

另请参阅适合您的用例的示例

https://react-slick.neostack.com/docs/example/multiple-items

关于reactjs - 如何使用reactjs从左向右滚动我的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60717191/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com