开始时取消可拖动的div [英] Cancel draggable div on start

查看:105
本文介绍了开始时取消可拖动的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所拥有的:
可拖动的div,在启动时会发出警报,放下时会还原.

What I have:
Draggable divs that have an alert on start and revert when dropped.

我需要什么:
当用户尝试拖动div时,会弹出警报,提示您无法拖动div,并且拖动会在它移到任何位置之前停止.

What I need:
When user tries to drag the div, an alert pops up saying you can't drag it and the dragging stops before it even goes anywhere.

推荐答案

您可以在

You can return false within the start() method to accomplish this:

$("#draggable").draggable({
    start: function(event, ui) {
        alert('Dragging is disabled');
        return false;
    }
});

JSFiddle: http://jsfiddle.net/Jam8Z/

JSFiddle: http://jsfiddle.net/Jam8Z/

这篇关于开始时取消可拖动的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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