拖动元素时如何禁用阻塞光标?

问题描述

我正在一个小网页中实现“拖放”功能,但是,我遇到了一个界面问题。

每当我尝试拖动 draggable 属性设置为 true 的元素时,浏览器都会在该元素旁边显示一个 blocking-icon

下面是一张有助于说明问题的图片

Blocking icon on drag attempt

有谁知道如何更改那个图标,或者它是不可解决的吗?

<!DOCTYPE html>
<html lang="en">
<head>
    <Meta charset="UTF-8">
    <title>Document</title>
    <style>
        #dropzone {
            background-color: #eee;
            border: 1px dashed #aaa;
            max-width: 200px;
            padding: 100px;
            -webkit-user-drag: auto;
        }
        .draggable {
            width: 100px;
            height: 50px;
            background-color: burlywood;
            border-radius: 10px;
            margin: 20px;
            line-height: 50px;
            text-align: center;
        }
    </style>
</head>
<body>
<div></div>
<div id="dropzone">
    <p style="text-align: center;"><b>Dropzone</b><br>Drag anything over here</p>
</div>
<div class="draggable" id="o1" draggable="true">Object 1</div>
<div class="draggable" id="o2" draggable="true">Object 2</div>
<script>
    window.ondragstart = function(e) {
        e.dataTransfer.setData('text/plain',e.target.id);
    }
    
    var dropzone = document.querySelector('#dropzone');

    dropzone.ondragover = function(e) {
        e.preventDefault();
    }
    dropzone.ondrop = function(e) {
        // this.innerHTML = '';
        this.appendChild(document.getElementById(e.dataTransfer.getData('text/plain')));
    }
</script>
</body>
</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)