在javascript中检测HTML5拖放支持 [英] Detecting HTML5 Drag And Drop support in javascript

查看:106
本文介绍了在javascript中检测HTML5拖放支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在JavaScript中检测HTML5拖放支持。

解决方案

您可以这样做:


$ b $如果('draggable'in document.createElement('span')){
alert(拖动支持检测到); b

  
}

您可以使用上述检查来查看快速演示测试



另外,有一个很好的功能检测(不是浏览器检测,yay!)列表,这里保持相当好的维护,以防万一你也在寻找其他的HTML5功能。 / p>

I'm trying to detect the HTML5 Drag And Drop support in JavaScript. Modernizr seems to not handle this test case.

You can do this:

if('draggable' in document.createElement('span')) {
  alert("Drag support detected");
}

You can see a quick demo test using the above check here.

Also, there's a nice feature detection (not browser detection, yay!) list that's fairly well maintained here in case you're looking for other HTML5 features as well.

这篇关于在javascript中检测HTML5拖放支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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