Bootstrap_让Bootstrap轮播插件carousel支持左右滑动手势的三种方法
2024-08-21 21:58:37
Bootstrap 的 carousel.js 插件并没有支持手势。
3种解决方案 :
jQuery Mobile (http://jquerymobile.com/download/)
$("#carousel-generic").swipeleft(function() {
$(this).carousel('next');
}); $("#carousel-generic").swiperight(function() {
$(this).carousel('prev');
});
TouchSwipe jQuery plugin (https://github.com/mattbryson/TouchSwipe-Jquery-Plugin)
$("#carousel-generic").swipe({
swipeLeft: function() { $(this).carousel('next'); },
swipeRight: function() { $(this).carousel('prev'); },
});
hammer.js (http://eightmedia.github.io/hammer.js/) +
jquery.hammer.js (https://github.com/EightMedia/jquery.hammer.js)
$('#carousel-generic').hammer().on('swipeleft', function(){
$(this).carousel('next');
}); $('#carousel-generic').hammer().on('swiperight', function(){
$(this).carousel('prev');
});
hammer.js 官网:http://hammerjs.github.io/ ,版本基于v2.0.4:
var carousel = new Hammer(document.getElementById("carousel"));
carousel.on('swipeleft', function(){
$(this).carousel('next');
}); carousel.on('swiperight', function(){
$(this).carousel('prev');
});
最新文章
- app的自动更新(调用DownloadManager)
- MFS文件系统
- oracle11gRAC环境使用RMAN增量备份方案
- 控制WIFI状态
- libpq程序例子
- Linux通配符
- -fembed-bitcode is not supported on versions of iOS prior to 6.0
- Asp.net简单实现forms验证
- Treasure Exploration(二分最大匹配+floyd)
- NMON监控工具
- Flocker 做为后端存储代理 docker volume-driver 支持
- .NET Core容器化之多容器应用部署@Docker-Compose
- 点击button1弹出form2,并在form2中点击button2来调用form1的方法
- HTML meta refresh 刷新与跳转(重定向)页面
- IDEA使用总结
- 按住CTRL多选,按住shift连选的实现
- 局域网内ping [局域网内ip地址]命令详解
- BZOJ2150 部落战争 【带上下界最小流】
- (C#基础)各种加密学习
- MySQL5.7 主从复制配置
热门文章
- MySQL5.6 on Windows 安装失败: String was not recognized as a valid DateTime
- Introduction to replication 翻译
- 記錄一次CRS-0184: Cannot communicate with the CRS daemon的解決
- C# 非UI线程对控件的控制
- ThinkPHP中getField( )和field( )
- WPF Navigation
- [Linux][Hadoop] 将hadoop跑起来
- 用PowerShell脚本实现对SharePoint页面Title的修改
- Android学习系列(39)--Android主题和样式之系统篇(上)
- FastMM 定位内存泄露的代码位置