Reputation: 283
I am trying to capture the coordinates of list items on their current position and also after they have been dragged and dropped to some place. I am able to capture the cooedinates before thr drag and drop. I am not able figure out what to do after the drag and drop. please help.
the html:
<ul class="sortable">
<li class="ui-state-default" id="third">3</li>
<li class="ui-state-default" id="fourth">4</li>
<li class="ui-state-default" id="fifth">5</li>
<li class="ui-state-default" id="sixth">6</li>
<li class="ui-state-default" id="seventh">7</li>
<li class="ui-state-default" id="eighth">8</li>
<li class="ui-state-default" id="ninth">9</li>
<li class="ui-state-default" id="tenth">10</li>
<li class="ui-state-default" id="eleventh">11</li>
</ul>
the jquery:
$(function () {
$(".sortable").sortable();
$(".sortable").disableSelection();
//---------------------------------------------------------------------------------------------------------------------------//
//rounded-corner || ui-state-default
$('.rounded-corner').on('click', function(){
var offset = $(this).offset();
alert('top - ' + offset.top + "\nleft - " + offset.left);});
//ONCLICK CLOSE
/*$(".ui-state-default").click(function () {
var tblId = $(this).attr("id");
// alert(tblId);
var ans = confirm("Are you sure you want to remove this table?");
if(ans == true)
$("#" + tblId).hide();
//else exit();
});*/
//---------------------------------------------------------------------------------------------------------------------------//
$(".glyphicon-remove").click(function () {
var tblId = $(this).parent().attr("id");
// alert(tblId);
var ans = confirm("Are you sure you want to remove this table?");
if(ans)
$("#" + tblId).hide(500);
//else exit();
});
$(document).bind("contextmenu", function(e) {
var tblId,tbl, ans;
tblId = $(this).parent().attr("id");
tbl = $("#" + tblId);
if (!(tbl.is(":visible"))) {
// It's not showing
ans = confirm("Are you sure you want to show this table?");
}
if(ans){
$('.glyphicon-remove').parent().show(500);
}
return false;
});
});
Upvotes: 1
Views: 74