angular中使用 owl-carousel-o

文章展示了如何使用OwlCarousel2库创建一个响应式的图片滑动展示,通过Angular的*ngFor指令动态渲染内容,并配置了不同的屏幕尺寸下的items数量,支持鼠标拖动和多点触控,提供了导航点和自动宽度调整功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

demo: https://owlcarousel2.github.io/OwlCarousel2/demos/responsive.html

<owl-carousel-o [options]="customOptions">
		<ng-container *ngFor="let item of data">
				<ng-template carouselSlide [id]="item.id" [width]="280">
						{{item}}
				</ng-template>
		</ng-container>
</owl-carousel-o>
customOptions = {
			margin: 20,
			loop: false,
			mouseDrag: true,
			touchDrag: false,
			pullDrag: false,
			dots: true,
			navSpeed: 800,
			items: 5,
			autoWidth: true,
			responsive: {
				300: {
					items: 1,
				},
				600: {
					items: 2,
				},
				900: {
					items: 3,
				},
				1180: {
					items: 4,
				},
				1400: {
					items: 5,
				},
			},
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值