相关疑难解决方法(0)

在HTML5中拖动时如何更改光标图标?

我需要在用户拖动DIV时设置光标图标(以下示例中为红色div).

我尝试了几次尝试,包括使用CSS cursor:moveevent.dataTransfer.dropEffect没有成功,因为图标总是显示"交叉圆圈".

有关如何使用HTML5拖放API解决此问题的任何想法?

http://jsbin.com/hifidunuqa/1/

 <script>
        window.app = {
            config: {
                canDrag: false,
                cursorOffsetX: null,
                cursorOffsetY: null
            },
            reset: function () {
                this.config.cursorOffsetX = null;
                this.config.cursorOffsetY = null;
            },
            start: function () {
                document.getElementById('target').addEventListener('dragstart', function (event) {
                    console.log('+++++++++++++ dragstart')
                    this.config.cursorOffsetX = event.offsetX;
                    this.config.cursorOffsetY = event.offsetY;
                    this.adjustPostion(event);
                    event.dataTransfer.effectAllowed = 'move';
                    event.dataTransfer.dropEffect = 'move';
                }.bind(this));
                document.getElementById('target').addEventListener('drag', function (event) {
                    console.log('+++++++++++++ drag')
                    this.adjustPostion(event);
                }.bind(this));
                document.getElementById('target').addEventListener('dragend', function (event) {
                    console.log('+++++++++++++ dragend')
                    this.reset();
                }.bind(this));;
            },
            adjustPostion: function (event) {
                if (event.pageX <= …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery html5

22
推荐指数
2
解决办法
2万
查看次数

拖动时 HTML5 拖放更改光标(不要使用 UI)

我想改变cursor拖动时的,所以我尝试这种方式:

function drag (event) {

    localStorage.setItem("no", $(event.target).data("no"));

    $("html").css("cursor", "move");

}
Run Code Online (Sandbox Code Playgroud)
<tr draggable="true" class="memo_item move" id="memo_<?php echo $memo->memo_no?>" ondragstart="drag(event, this);" data-no="<?php echo $memo->memo_no?>"></tr>
Run Code Online (Sandbox Code Playgroud)

但它不起作用。

而且我不能用JQueryUi

如何更改光标?

html drag-and-drop

7
推荐指数
1
解决办法
7867
查看次数

在javascript中拖动光标?

我需要在某些地方设置拖动光标,但我可以'看到这里听过http://www.w3schools.com/cssref/pr_class_cursor.asp

在我的情况下,当我拖动一些图像时它会出现:

拖动光标http://s2.subirimagenes.com/otros/previo/thump_8236773bgform29.jpg http://s2.subirimagenes.com/otros/previo/thump_8236773bgform29.jpg

是否有像{body:drag}一样使用的代码?

html javascript css events cursor

4
推荐指数
1
解决办法
7256
查看次数

标签 统计

html ×3

css ×2

javascript ×2

cursor ×1

drag-and-drop ×1

events ×1

html5 ×1

jquery ×1