InterbredMonkey
02-26-2010, 11:08 AM
I have made a page with 3 columns with sortable divs. I need to be able to track the divs when they are moved so that when the user closes the page the divs will be in the same locations they were moved to. I got the following code from the BBC website yet I cannot get it to work. Anyone know what is wrong with it?
Code:
function update_positions(e, ui){
var widget_cookie_positions = loadCookie('iARC_widget_positions');
var moved_widget_id = $(ui.item).attr('id');
var moved_to_column_id = $(ui.item).parents('.column').attr('id');
var column_order = "0";
$('#' + moved_to_column_id + '> .widget').each(function(){
var widget_id = $(this).attr('id');
panel_positions[panel_id] = moved_to_column_id + ':' + column_order;
column_order++;
});
};
Code:
function update_positions(e, ui){
var widget_cookie_positions = loadCookie('iARC_widget_positions');
var moved_widget_id = $(ui.item).attr('id');
var moved_to_column_id = $(ui.item).parents('.column').attr('id');
var column_order = "0";
$('#' + moved_to_column_id + '> .widget').each(function(){
var widget_id = $(this).attr('id');
panel_positions[panel_id] = moved_to_column_id + ':' + column_order;
column_order++;
});
};