js禁止手機長按彈出選單,但他把長按事件也給禁了
我是用的是騰訊的AlloyFinger手勢庫長按事件
var ent4 =document.getElementById("ent4");
Transform(ent4);
new AlloyFinger(ent4, {
longTap:function(evt){
$(".cfposk").show("drop");
$("#cfpo-ent4").show("drop");
$(ent4).css({"z-index":"12","background":"#c9cc19"});
evt.preventDefault();
},
touchEnd:function (evt) {
$(".cfposk").hide("drop");
$("#cfpo-ent4").hide("drop");
$(ent4).css({"background":"transparent","z-index":"10"});
evt.preventDefault();
}
});當我要禁止長按彈出默認選單時,
*{
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}
$("#ent4").on('touchstart', function(e){
e.preventDefault();
},false);
在Safari瀏覽器上可以,但華為瀏覽器這樣子寫平板上雖然不能禁止全部的頁面長按彈出選單,但能禁止我需要長按的元素彈出選單,但在手機上的華為瀏覽器不行,禁止長按彈出選單也把我自己寫的長按事件點擊事件都給禁止了。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/45495.html
標籤:JavaScript
下一篇:套接字
