I'm having trouble saving the position of my divs sortable
. I use this code to save positions:
<script type="text/javascript">
jQuery(function($) {
var cookieName="List"
var list = localStorage.getItem(cookieName)
if (list) $("#sortable").html(list)
$("#sortable").sortable({
items: ">:not(#trash)",
revert : 300,
update: function(e, ui) {
localStorage.setItem(cookieName, $("#sortable").html()) // save new order
}
}).disableSelection()
$("#sortable").draggable();
$('#trash').droppable({
drop: function(event, ui) {
ui.draggable.remove();
}
});
});
And the structure of the divs looks something like this:
<div class="row" id="sortable">
<div class="col-sm-2">
<div class="well id="show1">
<span style="float: right;"><i class="fa fa-cog fa-1x" aria-hidden="true"></i></span>
<div class="text-center">
<i class="fa fa-thermometer-2 fa-3x" aria-hidden="true"></i>
<span id="minis1" style="font-weight:bold;"></span>
</div>
</div>
But the problem is this: It is saving the state of the divs along with its content. I need to save only the position of .well, not the content within it. It turns out that content inside the well is not static, it changes, refreshes, and saving in place storage
causes the div to always be static, only updating when I delete the localstorage
cache. Can anyone help me?