angular - 如何使滑动滑块以角度响应
问题描述
我的角度项目中有一个滑动滑块。它在桌面视图中有 4 个项目。我想要移动视图中的 1 个项目。检查这个链接
https://stackblitz.com/edit/ngx-swiper-wrapper-demo-h9egdh?file=app/app.component.ts
演示 .ts 代码在这里
public slides = [
'First slide',
'Second slide',
'Third slide',
'Fourth slide',
'Fifth slide',
'Sixth slide'
];
public type: string = 'component';
public disabled: boolean = false;
public config: SwiperConfigInterface = {
direction: 'horizontal',
slidesPerView: 4,
keyboard: true,
mousewheel: true,
scrollbar: false,
navigation: true,
pagination: false
};
解决方案
您可以将断点属性添加到配置 JSON,如下所示:
public config: SwiperConfigInterface = {
direction: 'horizontal',
slidesPerView: 4,
keyboard: true,
mousewheel: true,
scrollbar: false,
navigation: true,
pagination: false,
breakpoints:{
640:{
slidesPerView: 1,
}
}
};
断点可以是您需要的任何大小,有关更多信息,您可以查看: https ://github.com/nolimits4web/Swiper/blob/master/demos/380-responsive-breakpoints.html
推荐阅读
- java - 在控制器中调用多个方法或覆盖服务中的一个方法中的所有调用?
- disk - 如何扩展 AFPS 容器的大小?
- json - 如何使用颤振在小部件中显示复杂的 JSON?
- python - 为什么 Python BeautifulSoup 对象是可调用的?定义在哪里?
- c - C 程序 - 从文件中读取整数并解码秘密消息
- r - 基于多个条件匹配两个数据帧的行
- python - 你好!如何使这个简单?我是 python 新手 :)
- python - Pytesseract - 图像上的 OCR,带有不同颜色的文本
- regex - 如何编写 SED 脚本以使用正则表达式根据用户输入替换文件中存在的版本代码
- javascript - 在另一台机器上启动反应应用程序