我在jQuery中有这些代码行,我需要在字符串中捕获swype类型的名称。
$('.client-content').on('swipeleft swiperight', function(){
var curActiveClient = $('.clients-belt').find('.active-client'),
position = $('.clients-belt').children().index(curActiveClient),
clientNum = $('.client-unit').length;
if (event === 'swipeleft') {
//do something
} else if (event === 'swiperight') {
//do something else
}
答案 0 :(得分:0)
如果我理解正确,你想要的是知道滑动是左还是右......
$('.client-content').on('swipe', function(){
var curActiveClient = $('.clients-belt').find('.active-client'),
position = $('.clients-belt').children().index(curActiveClient),
clientNum = $('.client-unit').length;
$(this).on("swipeleft", function(){
//some code
})
$(this).on("swiperight", function(){
//some code
})
}