我有一个使用jquery拖放的rails应用程序。它肯定适用于windows chrome,即linux firefox,linux chromium但不是linux chrome!
看起来很奇怪,因为在linux chrome中,可拖动的图像被克隆,捕捉到拖放区域,但是不会调用drop函数。删除函数,在相同的js中工作。这一切都适用于我用过的所有其他浏览器!
我已阅读各种stackoverflow问题和答案,但似乎都没有适用。
有人有任何想法吗?
您可以在此处查看应用程序 - http://rails-drag-drop.herokuapp.com/articles/1/edit
这是我的js
$(function() {
$( make_draggable_and_droppable_and_deletable() );
function make_draggable_and_droppable_and_deletable() {
$('.this_is_draggable').draggable({
helper: 'clone',
snap: '.this_is_droppable',
cursor: 'move'
});
$('.this_is_droppable').droppable( {
drop: drop_article
});
$(".delete-child_link").click(function() {
deleteChildArticle(this.id);
});
}
function refresh() {
$("#edit-article-children").load(location.href+" #edit-article-children>*", function (){
make_draggable_and_droppable_and_deletable();
});
}
function drop_article(event,ui) {
createChildArticle( this.id, ui.draggable.attr('id') );
}
function createChildArticle( parent_id, child_id ) {
$.ajax({
type: "POST",
url: "/links/",
data: {link : {
parent_id : parent_id,
child_id : child_id
}
},
datatype: "script",
remote: "true",
success: function(){
refresh();
}
});
}
function deleteChildArticle( ChildArticleID ){
$.ajax({
type: "DELETE",
url: "/links/" + ChildArticleID,
data: {link : {
id : ChildArticleID
}
},
datatype: "script",
remote: "true",
success: function(){
refresh();
}
});
}
//closing document ready tag
});
其余代码在github上 - https://github.com/aldreth/drag-and-drop