2012-02-16 13 views
0

アップロード可能なアップロードビデオボタンをドラッグ可能な要素に配置しようとしています。jquery draggable divでuploadifyが機能しない

動画/ _new_video

<p>Upload your Video </p> 
<div id="video_attachment"></div> 

<%= content_for (:scripts) do%> 
<script type="text/javascript"> 
    $(function() { 
    <% session_key = Rails.application.config.session_options[:key] %> 
    var uploadify_script_data = {}; 
    var csrf_token = $('meta[name=csrf-token]').attr('content'); 
    var csrf_param = $('meta[name=csrf-param]').attr('content'); 

    uploadify_script_data[csrf_param] = encodeURI(encodeURIComponent(csrf_token)); 
    uploadify_script_data['<%= session_key %>'] = '<%= cookies[session_key] %>'; 

    $('#video_attachment').uploadify({ 
     uploader : '<%= asset_path("uploadify/uploadify.swf") %>', 
     script : '<%= videos_path %>', 
     wmode  : 'transparent', 
     cancelImg : '<%= asset_path("uploadify/cancel.png") %>', 
     fileDataName : 'attachment', 
     scriptData : uploadify_script_data, 
     auto  : true, 
     buttonText : 'Browse', 
     onAllComplete : function(event, data){ 
     alert("Success! Please be patient while the video processes."); 
     }, 
     onError: function(event, ID, fileObj, errorObj){ 
     alert("There was an error with the file you tried uploading.\n Please verify that it is the correct type.") 
     } 
    }); 
    }); 
</script> 

application.js

//= require jquery 
//= require jquery_ujs 
//= require uploadify/jquery.uploadify.v2.1.4.min 
//= require uploadify/swfobject 

profile.js私のプロフィール/ショーで

$(document).ready(function(){ 

/* For edit_draggable */ 
    $("#edit-draggable").draggable(); 

$("#edit-draggable").hide(); 

}); 

マイアップロード動画は、部分的、uploadifyが外に動作します次のようなdraggable div:

<%= render "videos/new_video"%> 
<div id="edit-draggable" class="ui-widget-content ui-dialog"> 

    <%= render "edit"%> 
</div> 

が、それはこのようなドラッグ可能なdivの内部で動作しません。

<div id="edit-draggable" class="ui-widget-content ui-dialog"> 
    <%= render "videos/new_video"%> 
    <%= render "edit"%> 
</div> 

誰もが問題が何であるかを知っていますか?

ご協力いただきありがとうございます。

答えて

0

私はこれを理解したので、自分の質問に答えるつもりです。

ドラッグハンドルのないドラッグ可能なdivは、div内のクリックイベントをマスクしているため、アップロード可能なボタンはドラッグ可能にブロックされていました。

解決策はドラッグハンドルを追加することでした。したがって、divはdivの一部をクリックするだけでドラッグ可能です。

2

これは動作するはずです:

.draggable({ cursor: "move", cancel: '.uploadify'}) 
関連する問題