$(function() {
var xpos = $(`#${currentid}`).position();
console.log(xpos.top);
var sPositions = localStorage.positions || "{}",
positions = JSON.parse(sPositions);
$.each(positions, function(id, pos) {
$("#" + id).css(pos);
console.log("it saves");
})
$(`#${currentid}`).draggable({
containment: "#body1",
scroll: false,
stop: function(event, ui) {
positions[this.id] = ui.position;
localStorage.positions = JSON.stringify(positions);
console.log("it loads");
}
});
});
In this, I have to traverse to each element but it still not working please help