1. 程式人生 > >移動端阻止默認長按選中文本和彈出菜單、點擊陰影

移動端阻止默認長按選中文本和彈出菜單、點擊陰影

prevent efault css mce web 點擊 阻止 tran call

css:

/*阻止默認長按選中文本*/
* {
/*ios*/
-webkit-touch-callout:none;
touch-callout:none;

/*安卓*/
-webkit-user-select: none;
user-select: none;
}


js:

//阻止默認長按出現菜單
window.ontouchstart = function(e) {
e.preventDefault();
};

/*阻止默認點擊出現陰影*/
*{-webkit-tap-highlight-color: rgba(0,0,0,0);-webkit-tap-highlight-color:transparent;}





移動端阻止默認長按選中文本和彈出菜單、點擊陰影