使用jquery Touchwipe插件扩展jquery ui转盘
我正在尝试扩展jQueryUI小部件 小部件可在此处找到: 我使用的是0.8.5版。触摸扩展还不能工作,所以我需要通过扩展小部件为自己创建一些超基本的东西。我计划使用jQuery Touchwipe插件,可以在这里找到: 这是我一直在尝试的代码,但我对UI小部件没有太多经验,所以我有点迷路了。非常感谢您的帮助使用jquery Touchwipe插件扩展jquery ui转盘,jquery,jquery-ui,Jquery,Jquery Ui,我正在尝试扩展jQueryUI小部件 小部件可在此处找到: 我使用的是0.8.5版。触摸扩展还不能工作,所以我需要通过扩展小部件为自己创建一些超基本的东西。我计划使用jQuery Touchwipe插件,可以在这里找到: 这是我一直在尝试的代码,但我对UI小部件没有太多经验,所以我有点迷路了。非常感谢您的帮助 $.widget("rs.jdcarousel", $.extend({}, $.rs.carousel.prototype, { _touch: function(){ el
$.widget("rs.jdcarousel", $.extend({}, $.rs.carousel.prototype, {
_touch: function(){
elems.mask.touchwipe({
wipeLeft : function() { if( theCarousel.isHorizontal ){ theCarousel.next(); } },//alert("left"); },
wipeRight : function() { if( theCarousel.isHorizontal ){ theCarousel.prev(); } },//alert("right"); },
wipeUp : function() { if( !theCarousel.isHorizontal ){ theCarousel.prev(); } },//alert("up"); },
wipeDown : function() { if( !theCarousel.isHorizontal ){ theCarousel.next(); } }, //alert("down"); },
min_move_x : 20, //check this
min_move_y : 20,
preventDefaultEvents: true
});
}
// Override other methods here.
}));
$.rs.jdcarousel.defaults = $.extend({}, $.rs.carousel.defaults);
这显然是行不通的
有人能帮我打捞这个吗
谢谢
-雅各布以下是我所做的:
我加载了jquery TouchWipe插件:
然后,我在页面中添加了以下js:
var swipeOptions = {
swipe : swipe,
threshold : 75
}
$("#investments").swipe( swipeOptions );
function swipe( event, direction ) {
if (direction == "left") {
$("#investments").carousel('next');
}
else if (direction == "right") {
$("#investments").carousel('prev');
}
}
一切都很好