I currently have a simple setup of div-boxes that I can move through the jquery draggable functionalities. I now encountered a problem I just can't figure out. The dragging works perfectly fine if I initially load the page with the following setup:
html:
<div id="box_1" class="card ui-widget-content"><p>Peter</p></div>
<div id="box_2" class="card ui-widget-content"><p>Susan</p></div>
...
css:
.card {
width: 200px;
height: 280px;
border: 1px solid blue;
padding: 10px;
margin: 15px;
box-sizing: border-box;
float: left;
position: static;
}
js:
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script>
$(document).ready(function(){
$( ".card" ).draggable();
});
</script>
Now I wanted to add a button that "resets" the divs to the original grid:
$( "#grid" ).click(function()
{
$('.card').css({position: 'static'});
});
I thought it would be easiest to just use "position: 'static'", as this already works when opening the page. Now the problem here is, that while the divs readjust to a grid the way I want them to, the draggable functionality is gone.
I already tried to 'disable' and 'enable' draggable on the divs but it does not do the trick.
I am kind of confused why the functionality just stops.
Thank you very much for your help :D