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');
});

最新文章

  1. app的自动更新(调用DownloadManager)
  2. MFS文件系统
  3. oracle11gRAC环境使用RMAN增量备份方案
  4. 控制WIFI状态
  5. libpq程序例子
  6. Linux通配符
  7. -fembed-bitcode is not supported on versions of iOS prior to 6.0
  8. Asp.net简单实现forms验证
  9. Treasure Exploration(二分最大匹配+floyd)
  10. NMON监控工具
  11. Flocker 做为后端存储代理 docker volume-driver 支持
  12. .NET Core容器化之多容器应用部署@Docker-Compose
  13. 点击button1弹出form2,并在form2中点击button2来调用form1的方法
  14. HTML meta refresh 刷新与跳转(重定向)页面
  15. IDEA使用总结
  16. 按住CTRL多选,按住shift连选的实现
  17. 局域网内ping [局域网内ip地址]命令详解
  18. BZOJ2150 部落战争 【带上下界最小流】
  19. (C#基础)各种加密学习
  20. MySQL5.7 主从复制配置

热门文章

  1. MySQL5.6 on Windows 安装失败: String was not recognized as a valid DateTime
  2. Introduction to replication 翻译
  3. 記錄一次CRS-0184: Cannot communicate with the CRS daemon的解決
  4. C# 非UI线程对控件的控制
  5. ThinkPHP中getField( )和field( )
  6. WPF Navigation
  7. [Linux][Hadoop] 将hadoop跑起来
  8. 用PowerShell脚本实现对SharePoint页面Title的修改
  9. Android学习系列(39)--Android主题和样式之系统篇(上)
  10. FastMM 定位内存泄露的代码位置