2015-06-11 123 views
0

我试图建立一个小拼图。
没有必要使用我正在使用的库。
如果您尝试我的小提琴:http://jsfiddle.net/fskwbrbb/
如何将Nr 3拖放到“dropzone”的顶部,并且将Nr2放在Nr1的旁边,而Nr1放在Nr1的旁边?jquery拼图,可排序,可拖拽&放下

------| 
    3 | 
------| 
----||---| 
    2 || 1 | 
----||---| 
+0

',但对NR 1的侧面'什么Nr1时? –

+0

我不认为你会这样做,没有使用网格,并没有计算*剩余的免费网格单元* ... –

+1

这应该让你开始关于网格:http://stackoverflow.com/questions/20695744/getting-jquery-draggable-to-snap-to-specific-grid –

回答

0

我为此使用了Jquery Shapeshift。

JS

//Create new container 
$('#btnAddContainer').on('click', function() { 
//Container HTML setup 
var containerHtml = $('<div class="container"></div>'); 

//Insert continer 
$('.containers').append(containerHtml); 

//Shapeshift 
$('.container').shapeshift({ 
    enableDrag: true, 
    enableCrossDrop: true, 
    minColumns: 1 
}); 
}); 

检查这个捣鼓代码:

https://jsfiddle.net/umcgqmwv/2/ 
+0

你需要解释如何让这个答案对任何遇到这个问题的人都有用。 –