使用JavaScript在移动设备上禁用longPress操作 [英] Disable longPress action on mobile with javascript

查看:67
本文介绍了使用JavaScript在移动设备上禁用longPress操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此期间,我制作了一些新的webApp,但是拖放存在很大的问题. 我用javascript写了一个文件管理器,但是在移动设备(智能手机,平板电脑和平板电脑或iOs)上,我尝试进行拖放操作,手机会向我显示用于复制URL或图像的longPress菜单(例如,在文件夹图标上). JS中有某种方法可以在移动设备上禁用longPress吗?

in this period,I make some new webApps, but I have a big problem with drag and drop. I write a file manager in javascript, but when on mobile (smartphone, tablet andorid or iOs) I try to work drag and drop, the phone show me the longPress menu (on folder icon for examample) for copy url or image. there is some way in JS to disable longPress on mobile?

通过CSS加载图像,对我来说不是有效的解决方案.

load image via css, isn't a valid solutions for me.

推荐答案

-webkit-touch-callout: none;                /* prevent callout to copy image, etc when tap to hold */
    -webkit-user-select: none;                  /* prevent copy paste, to allow, change 'none' to 'text' */

这篇关于使用JavaScript在移动设备上禁用longPress操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆