2014-01-30 87 views
1

我有這個拖放代碼,除了在iPad上運行良好,任何人都可以給出任何理由爲什麼?JavaScript拖放不工作在iPad上

它作爲接縫雖然它不能承認這樣一個事實,而不是別的

JS Fiddle

<span class="draggable" id="drag1" draggable="true" ondragstart="drag(event)">drag</span> 
<span class="draggable" id="drag2" draggable="true" ondragstart="drag(event)">drop</span> 
<br /> 
This is a sample 
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div> 
and 
<div id="div2" ondrop="drop(event)" ondragover="allowDrop(event)"></div> 
sentence. 

的JavaScript可以拖:

function allowDrop(ev){ 
     ev.preventDefault(); 
     } 
     function drag(ev){ 
     ev.dataTransfer.setData("Text",ev.target.id); 
     } 
     function drop(ev){ 
     ev.preventDefault(); 
     var data=ev.dataTransfer.getData("Text"); 
     ev.target.parentNode.replaceChild(document.getElementById(data), ev.target); 
     document.getElementById(data).className = ""; 
     } 

回答