gpt4 book ai didi

android - CSS:-webkit-touch-callout 替代品 for android

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:16:38 26 4
gpt4 key购买 nike

-webkit-touch-callout 是否有任何替代方案,它适用于基于 Android 的手机。我正在尝试禁用移动设备中的长按弹出窗口。我试图绑定(bind) jQuerys taphold 事件以返回 false;但没有运气......任何的想法?谢谢!

最佳答案

<!DOCTYPE html>
<html>
<head>
<script>
function absorbEvent_(event) {
var e = event || window.event;
e.preventDefault && e.preventDefault();
e.stopPropagation && e.stopPropagation();
e.cancelBubble = true;
e.returnValue = false;
return false;
}

function preventLongPressMenu(node) {
node.ontouchstart = absorbEvent_;
node.ontouchmove = absorbEvent_;
node.ontouchend = absorbEvent_;
node.ontouchcancel = absorbEvent_;
}

function init() {
preventLongPressMenu(document.getElementById('theimage'));
}
</script>
</head>
<body onload="init()">
<img id="theimage" src="http://www.google.com/logos/arthurboyd2010-hp.jpg" width="400">
</body>
</html>

来源:Disabling the context menu on long taps on Android

关于android - CSS:-webkit-touch-callout 替代品 for android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16011159/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com