现在我有一个网页功能,它会在除restrictArea 之外的所有窗口中触发。我已经让restrictArea 与主要内容重叠。我怎样才能指定这个区域不触发该功能?我试过e.preventDefault();
了,但似乎不起作用。谢谢
$(document).swipe(function(){
...............
};
$('#flip').swiperight(function(e){
e.stopPropagation();
e.preventDefault();
});
更新:所有相关代码:
CSS:
*
{
-webkit-user-select: none; /* disable auto selection (select/selectall when long tap)*/
-webkit-touch-callout: none; /* disable magnifier*/
}
#flip
{
position:absolute;
background-color:red;
z-index:10;
height: 100%;
width:60%;
left:20%;
}
js:
$(document).swipeleft(function(){
//check the case when popup and thumbnail slide bar is not exist
if ($("#popup").length == '0' && parseInt($('#all_pages').css('left')) != '0'){
if (checkOrientation (orientation)== 'landscape'){
var pageLand = $('#book').turn('view');
pageLand = pageLand[1];
if (pageLand + 1 < countImage && pageLand != '0')
$('#book').turn('page', pageLand + 1);
}
else{
var pagePort = $('#book').turn('page');
if (pagePort + 1 < countImage && pagePort != '0')
$('#book').turn('page', pagePort + 1);
}
}
});
$(document).swiperight(function(){
//check the case when popup and thumbnail slide bar is not exist
if ($("#popup").length == '0' && parseInt($('#all_pages').css('left')) != '0'){
if (checkOrientation (orientation)== 'landscape'){
var pageLand = $('#book').turn('view');
pageLand = pageLand[0];
if (pageLand - 1 > 0)
$('#book').turn('page', pageLand - 1);
}
else{
var pagePort = $('#book').turn('page');
if (pagePort - 1 > 0)
$('#book').turn('page', pagePort - 1);
}
}
});
$('#flip').swiperight(function(e){
alert ('test');
e.stopPropagation();
e.preventDefault();
});
$('#flip').swipeleft(function(e){
alert ('test');
e.stopPropagation();
e.preventDefault();
});