I'm trying to make a project just to learn more about HTML5 , CSS3 and Javascript . In this project I have a div
that is type a panel
and another div
that would be a square that I would put inside that panel
. I'm using drag and drop to be able to drag these elements around the screen.
My question is: how could I do when I put div
inside panel
it binds to it and when I try to drag panel
, I drag it and div
? And does this panel automatically adjust itself to the size of div
?
This happens on the scrumwise site.
The code I already have is this one:
panel
<div class="panel panel-success" id="panel">
<div class="panel-heading">
<h3 class="panel-title">Qualquer texto</h3>
</div>
<div class="panel-body">
</div>
</div>
Div
<div style="width:100px; height: 100px; background-color: black;" id="div">
</div>
The javascript
<script type="text/javascript">
$(function () {
$("#panel").draggable();
$("#div").draggable();
});
</script>
Another thing, I'm using bootstrap too!