0
데이터베이스에서 draggable 후 div의 올바른 위치를 저장합니다.데이터베이스에 저장 한 후에 여러 div draggable을 잘못 배치했습니다.
<div id="content">
<div id=table_1 class="ui-widget-content" style= "border: 1px solid #aaaaaa; width: 50px;height: 50px;border-radius: 50%; top:0px; left:0px">vfvv </div>
<div id=table_2 class="ui-widget-content" style= "width: 50px; height: 30px; padding: 0.2em; border: 1px solid #aaaaaa;top:0px; left:0px"> </div></div>
내 jQuery 코드 :
<script>
$(function() {
var map = new Object();
//pour chaque div possedant lattribut class
$('div[class]').each(function(index){}).draggable(
{
//l'evenement stop correspond fin du drag
stop: function(event, ui) {
var position = $(this).position();
var $newPosX = ui.offset.left - $(this).offset().left;
var $newPosY = ui.offset.top - $(this).offset().top;
map[this.id] = ui.offset;
},
// permet de delimiter la zone
containment: "#content"}).click(function() {
alert('nouria mais rose');
});
$("form input[type=submit]").click(function() {
var allPosition='';
for (var m in map){
allPosition+= m +'-' + map[m].top + '-' + map[m].left+'/';
}
$('input[name=positionTables]').val(allPosition);
});
});
</script>
probleme가 연속 사업부에 내가 된 div를 표시 할 때 나는 공간이있다. seconde div에는 항상 공백이 있지만 첫 번째 공백은 없습니다.
에서 positions'properties를 사용하여, 당신은 바이올린을 만들 수 있습니까? –