0
Good morning, I want to use the Jquery-Ui Draggable
to accomplish the drag 'n drop from a side panel. The problem is that this panel is overlaid the page with a position: fixed
and when dragging the elements out, two situations occur:
- With the default configuration of draggable, the elements do not leave the
div
parent (panel); - When setting some settings on startup draggable, I can even drag the elements out of the
div
, but the event of drop on top of thebody
is never triggered.
This is what is happening when I try to drag items. In addition to not being able to release them, the mouse position is also incorrect.
This is the draggable configuration:
$('.draggable-dash').draggable({
revert: "invalid",
helper: 'clone',
appendTo: '.dropdashboard',
containment: 'body',
//zIndex: 2500,
scroll: false,
cursorAt: { top: -5, left: -5 },
start: function(){
$(this).hide();
},
stop: function(){
$(this).show()
}
});
I’m a few days away from cracking my head with this citizen, in case anyone knows how to fix it, I’ll be eternally grateful.
EDIT 1 - Follows CSS and HTML excerpt from panel
.theme-panel {
position: fixed;
right: -175px;
top: 150px;
z-index: 1020;
background: #fff;
padding: 15px;
width: 175px;
transition: right .2s linear;
border-radius: 4px 0 0 4px;
}
.theme-panel.theme-panel-lg .theme-panel-content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: scroll;
margin: 0;
padding: 20px;
}
<div class="theme-panel theme-panel-lg">
<a href="javascript:;" data-click="theme-panel-expand" class="theme-collapse-btn" id="tourTema"><i class="fa fa-cog"></i></a>
<div class="theme-panel-content">
<h5>Indicadores</h5>
<div class="theme-version draggitens">
<div class="row">
<div class="col-lg-4 col-md-6 text-center draggable-dash">
<p><img src="./img/area-chart.png"></p>
<p>Indicador 1</p>
</div>
<div class="col-lg-4 col-md-6 text-center draggable-dash">
<p><img src="./img/bar-chart.png"></p>
<p>Indicador 2</p>
</div>
<div class="col-lg-4 col-md-6 text-center draggable-dash">
<p><img src="./img/dashboard.png"></p>
<p>Indicador 3</p>
</div>
<div class="col-lg-4 col-md-6 text-center draggable-dash">
<p><img src="./img/line-chart.png"></p>
<p>Indicador 4</p>
</div>
<div class="col-lg-4 col-md-6 text-center draggable-dash">
<p><img src="./img/pie-chart.png"></p>
<p>Indicador 5</p>
</div>
<div class="col-lg-4 col-md-6 text-center draggable-dash">
<p><img src="./img/doughnut-chart.png"></p>
<p>Indicador 6</p>
</div>
</div>
</div>
</div>
</div>
I already have the droppable declared, but what happens is that the panel that has the elements is on the page (as if it were a sidebar). When I drop the element in the div with the droppable it fires the revert
– David
In this example I made the panel is also on the page (using
position: fixed;
, as you said in the question). You can put a part of your code running here?– Mauro Roberto
I edited the question and added an excerpt of CSS and HTML, I can not put all the content on account of CSS file and settings in Javascript.
– David