0

管理システムファイルでjqueryドラッグ可能なファイルをアクティブにするこのコードがあります.キャンセルをクリックすると確認ダイアログがポップアップし、ドラッグ可能なファイルは自動的に元に戻ります.誰か助けてもらえますか?

$(function() {
    $('.files-icons li').live('mouseenter',function() {
        var $this = $(this);
        if(!$this.is(':data(draggable)')) {
            $this.draggable({
                revert: 'invalid',
                helper: "original",
                opacity: 0.35,
                snapMode: 'inner',
                snap:true,
                snapTolerance: 35,
                distance: 8,
                revertDuration: 200,
                start: function(){

                }
            });
        }
    });
    $('.ic').live('mouseenter',function() {
        var $this = $(this);
        if(!$this.is(':data(droppable)')) {
            $this.droppable({
                tolerance: 'intersect',
                over: function() {
                },
                out: function() {
                },
                drop: function(event, ui) {
                    dest = $(this).attr('rel');
                    $.modal.confirm('Are u sure?', function()
                    {
                        $.ajax({
                            url:'<?= $this->request->webroot; ?>files/move/source:' + ui.helper.attr('rel')  + '/dest:' + dest ,
                        }).done(function(data) {
                            $(ui.draggable).remove();
                        });
                    }, function() {
                        return false;
                    });

                }
            });
        }
    });


});
4

1 に答える 1

3

cloneドラッグ可能として使用している場合は、確認されたときhelperに追加するdroppableか、確認されていないときに何もしないようにする必要があります。

ネイティブブラウザを使用したデモ:http confirm//jsfiddle.net/WbHAr/1/

使用しているモーダルプラグインへのリンクを投稿すると、そこからデモが作成されます。

于 2013-01-21T20:51:27.010 に答える