Below is my full code for my site's drag and drop, that saves positions into mysql This is a couple years old though and I would like to update my jquery to a newer version.
This code uses the older jquery version 1.0.2 and interface.js
I believe to use drag and drop with jquery's newer versions requires the use of jquery UI plugin?
Can someone who understands javascript/jquery help me to get this working with a newer version, when I try using new versions of jquery with it, it will not work
<script type="text/javascript" >
var USER={"ID":"<?php echo $uid; ?>"};
var _x;
var _y;
var _pos;
if(document.all){document.body.onload=b_onload;}
else{document.body.setAttribute("onload","b_onload()");}
function b_onload(){
$('#columns td.portlet_td').each(function(i){
$(this).children("br").remove();
});
$('#columns td.portlet_td').Sortable(
{
accept: 'portlet',
helperclass: 'sort_placeholder',
activeclass : 'sortableactive',
opacity: 0.7,
tolerance: 'touch',
handle:'.drag-handler',
onStop:function(){
var x = getPos();
if(!$("#lgif").get(0)){
$('<i'+'mg id="lgif" src="images/loading.gif" style="display:block;position:absolute;top:500px;left:50%;" />').appendTo('body');
}
var __top = (document.body && document.body.scrollTop)?(document.body.scrollTop):((document.documentElement && document.documentElement.scrollTop)? document.documentElement.scrollTop: 0);
$("#lgif").css({top:__top+'px'});
$("#lgif").show();
$.getJSON(
'/processing/ajax/HOMEsaveposition.php',
{
uid:(USER.ID),
position:x
},
function(json){
$("#lgif").hide();
}
);
}
}
);
};
function getPos(){
_pos="";
$('#columns td.portlet_td').each(function(i){
_x=i;
$(this).children(".portlet").each(function(j){
_y=j;
var index = this.getAttribute("id").split('id')[1] - 100;
var pos=_x+":"+index;
_pos+=pos+"|";
});
});
return _pos;
}
</script>