外国人,还是牛逼。
下载两个JS
2、https://github.com/hammerjs/jquery.hammer.js
注意:引入顺序1》2
1
2
3
4
5
6
7
8
9
10
11
|
<!-- 增强:BootStrap carousel(轮播)组件支持触屏 -->
<script src=
"dep/jquery.hammer.js-master/hammer.min.js"
></script>
<script src=
"dep/jquery.hammer.js-master/jquery.hammer.js"
></script>
<script>
$(
'#carousel-example-generic'
).hammer().on(
'swipeleft'
,
function
(){
$(
this
).carousel(
'next'
);
});
$(
'#carousel-example-generic'
).hammer().on(
'swiperight'
,
function
(){
$(
this
).carousel(
'prev'
);
});
</script>
|
本文转自 沫沫金 51CTO博客,原文链接:http://blog.51cto.com/zl0828/1769440,如需转载请自行联系原作者