我想创建拖动 uploader :
我在 darg 区域使用了一张图片:
我使用这个脚本来显示拖动通知:
<script type="text/javascript">
$(document).ready(function() {
$('.dargbar').bind('drop', function(e) {
alert('yes');
});
});
</script>
当我拖动图像时,它成功显示消息,但会自动在浏览器中加载图像。我怎样才能停止加载图片?
谢谢
最佳答案
尝试prevent default行为:
$('.dargbar').bind('drop', function(e) {
e.preventDefault();
alert('yes');
});
或者jQuery更支持:
$('.dargbar').bind('drop', function(e) {
e.originalEvent.preventDefault();
alert('yes');
});
关于php - 防止在拖动时显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13879782/