Aruta,
$(function () {
var blockIds = JSON.parse(localStorage.getItem('blockIds')), $prevBlock;
$.each(blockIds, function (i, id) {
var $thisBlock = $('#' + id);
$thisBlock.insertAfter($prevBlock);
$thisBlock.find('.order_position').append($('#position' + (i + 1)));
$prevBlock = $thisBlock;
});
});
$(window).on('unload', function () {
var blockIds = $('.order__wrap').map(function () { return this.id }).get();
localStorage.setItem('blockIds', JSON.stringify(blockIds));
});
|