jquery draggable issue can't drag in any empty parent div - jquery-ui

I am working on nested parent and child list item.
Here is demo link https://jsfiddle.net/fahadsheikh/kq5oxbrs/2/
The sortable and draggable working fine but when if one of parent div is empty than draggle not working.
$(document).ready(function() {
// Sort the parents
$(".sortMenu").sortable({
containment: "document",
items: "> div",
tolerance: "pointer",
cursor: "move",
opacity: 0.7,
revert: 300,
delay: 150,
placeholder: "menuPlaceholder",
start: function(e, ui) {
ui.placeholder.height(ui.helper.outerHeight());
}
});
// Sort the children
$(".menuItems").sortable({
items: "> div",
tolerance: "pointer",
containment: "document",
connectWith: '.menuItems'
});
});
$('#btn1').click(function() {
getSortableList('.sortMenu');
})
$('#btn2').click(function() {
getSortableList('.menuItems');
})
function getSortableList(className){
var sortables = $(className);
var myArray = new Array();
sortables.each(function() {
myArray = myArray.concat($(this).sortable('toArray'));
})
alert(myArray.length);
}
.menuGroup {
margin: 10px;
padding: 10px;
border: 1px solid #000000;
}
.menuGroup h2 {
margin: 0;
padding: 0px 0px 20px 0px;
}
.menuItems {}
.menuItem {
margin: 5px;
padding: 10px;
margin-left: 50px;
border: 1px solid #000000;
background-color: #cecece;
}
.menuPlaceholder {
width: 100%x;
height: 50px;
padding: 20px;
display: block;
margin: 0 0 15px 0;
background: #cccccc;
border: 1px dashed #000000;
}
<script src="https://code.jquery.com/jquery-3.2.1.min.js">
</script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<button id="btn1">get sortMenu </button>
<button id="btn2">get menuItems </button>
<div class="sortMenu">
<div class="menuGroup">
<h2>Parent #1</h2>
<div class="menuItems">
<div class="menuItem">
Child 1.1
</div>
<div class="menuItem">
Child 1.2
</div>
<div class="menuItem">
Child 1.3
</div>
<div class="menuItem">
Child 1.4
</div>
</div>
</div>
<div class="menuGroup">
<h2>Parent #2</h2>
<div class="menuItems">
<div class="menuItem">
Child 2.1
</div>
<div class="menuItem">
Child 2.2
</div>
</div>
</div>
</div>

This is a known bug.
Applying min-height should fix the issue
Add the following css
<style>
.menuItems {
min-height: 100px;
background: yellow; // optional
}
</style>

Related

Drag and Drop, cloneable and removeable

I've just started some days ago working with JQuery UI to allow some drag and drop and sorting on my homepage. In the code shown below, i wanted to add "+" and "-" to correct the equation "1_2_3=6", so the "+" has to been dropped two times to make the equation correct.
At the moment, it nearly works perfect. I can add as many "+" and "-" as I want, I can sort them into the equation. The only problem is, that I cannot remove any "+" or "-".
Can you give me any hint, how to be able to remove the signs by moving them out of the sortable window?
Thanks for your help!
<html>
<head>
<style>
#draggable { list-style-type: none; margin: 0; padding: 0; }
#draggable li { display: inline-block; margin: 1%; padding: 1%; font-size: 10vw; text-align:center; min-width:20px; border-style: solid; border-width: medium; border-color:black; background-color:grey;}
#sortable { float:left; list-style-type: none; width:100%; }
#sortable li { display: inline-block; margin: 0; padding: 0; font-size: 10vw; text-align:center; min-width:20px;}
</style>
<script src="jquery-1.12.4.js"></script>
<script src="jquery-ui.min.js"></script>
<script>
$( function() {
$( ".clone").draggable({
cursor:"move",
revert: "invalid",
connectToSortable: '#sortable',
helper: 'clone'
});
$( "#sortable").sortable({
connectWith: "ul",
cancel: ".ui-state-disabled",
});
} );
</script>
</head>
<body>
<ul id="draggable">
<li class="clone">+</li>
<li class="clone">-</li>
</ul>
<ul id="sortable">
<li class="ui-state-disabled">1</li>
<li class="ui-state-disabled">2</li>
<li class="ui-state-disabled">3=6</li>
</ul>
</body>
</html>
You can create a div when the UI components are dropped into the div you can remove the dropped component.
Sample code.
//HTML
<div class="removeDiv">
<p>Drop to remove</p>
</div>
//Style
.removeDiv{
width:100px;
height:100px;
background-color:red;
margin-top:150px;
}
//Script
$('.removeDiv').droppable({
over: function(event, ui) {
ui.draggable.remove();
}
});
This should get your work done.
Here's a fiddle for the above code. JS Fiddle
Expanding on my comment. Your code may look something like this.
$(function() {
$(".clone").draggable({
cursor: "move",
revert: "invalid",
connectToSortable: '#sortable',
helper: 'clone'
});
$("#sortable").sortable({
connectWith: "ul",
cancel: ".ui-state-disabled",
});
$(".trash").droppable({
accept: "#sortable > li",
classes: {
"ui-droppable-hover": "ui-state-highlight"
},
drop: function(event, ui) {
deleteItem(ui.draggable);
}
});
function deleteItem($o) {
$o.fadeOut().remove();
}
});
#draggable {
list-style-type: none;
margin: 0;
padding: 0;
}
#draggable li {
display: inline-block;
margin: 1%;
padding: 1%;
font-size: 10vw;
text-align: center;
min-width: 20px;
border-style: solid;
border-width: medium;
border-color: black;
background-color: grey;
}
#sortable {
list-style-type: none;
width: 100%;
}
#sortable li {
display: inline-block;
margin: 0;
padding: 0;
font-size: 10vw;
text-align: center;
min-width: 20px;
}
.trash {
width: 50px;
height: 50px;
border: 1px solid #000;
border-radius: 6px;
}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div class="drag-items" style="display: block;">
<ul id="draggable">
<li class="clone">+</li>
<li class="clone">-</li>
</ul>
</div>
<div class="problem" style="display: block;">
<ul id="sortable">
<li class="ui-state-disabled">1</li>
<li class="ui-state-disabled">2</li>
<li class="ui-state-disabled">3=6</li>
</ul>
</div>
<div class="trash">
<span class="ui-icon ui-icon-trash"></span>
</div>
In this code, add a small section for items to be dragged to and when they are dropped, they are removed. Also has visual feedback.

Owl carousel and parallax backgrounds

I have to use parallax.js to background images in owl carousel. For example I wanna use http://pixelcog.github.io/parallax.js/ with https://owlcarousel2.github.io/OwlCarousel2/docs/started-welcome.html
How can I do it?
pen: https://codepen.io/naaatasha/pen/gRdoej
<div class="owl-carousel slider">
<div class="item slide-wrapper parallax-window" data-parallax="scroll" data-image-src="http://trawnik.nazwa.pl/TrawnikProducent2016/wp-content/uploads/slide-strong-1.jpg">
<div class="container">
<div class="box">
<h2 class="h2 wow fadeIn text-right">co tam</h2>
<span class="subtitle wow fadeIn">ihsisdijbvjd</span>
</div>
</div>
</div>
<div class="item slide-wrapper parallax-window" data-parallax="scroll" data-image-src="http://www.focus.pl/upload/galleries/19/trawa-19061_l.jpg">
<div class="container">
<div class="box">
<h2 class="h2">lorem ipsum</h2>
<span class="subtitle">asdsk jbsjfd</span>
</div>
</div>
</div>
</div>
.slider {
position: relative;
display: table;
}
.box {
display: table-cell;
vertical-align: middle;
width: 1%;
}
.slide-wrapper {
height: 800px;
width: 100%;
background-color: #333;
backround-size: cover;
}
.h2 {
font-size: 40px;
font-weight: 500;
margin: 0;
text-transform: uppercase;
}
.subtitle {
display: block;
font-family: 'latolight', sans-serif;
font-size: 30px;
text-transform: uppercase;
}
.parallax-window {
min-height: 400px;
background: transparent !important;
}
jQuery(document).ready(function() {
jQuery(".slider").owlCarousel({
items: 1,
loop: true,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 4000,
animateIn: 'fadeIn',
//onChange : callback
});
// function callback(event) {
// jQuery('.parallax-window').parallax();
// }
});

JQuery UI draggable: All elements are moved istead of one - only in IE

I have a problem with draggable feature in Internet Explorer.
I have 2 columns, each of them contains a list of cards. I want to drag a card from one column to another.
Problem is when I start dragging, cards from other column are moved as well. This happens only in IE.
HTML:
<div class="card-container">
<div class="card-row">
<div column_id="1" class="card-column drag" style="width: 133px;">
<ul style="height:100%; width:100%" >
<li story_id="2" class="card" style="position: relative;">
<div>Card1</div>
</li>
</ul>
</div>
<div column_id="2" class="card-column drag" style="width: 133px;">
<ul style="height:100%; width:100%" class="snap">
<li story_id="1" class="card" style="position: relative;">
<div>Card2</div>
</li>
</ul>
</div>
</div>
</div>
JS:
$(".drag").find(".card").draggable({
revert: "invalid"
});
$(".card-column").droppable({
accept: ".card",
drop: function( event, ui ) {
$(this).find("ul").append("<li class=\'card ui-draggable\' story_id=\'" + ui.draggable.attr("story_id") + "\' style=\'position: relative;\'>" + $(ui.draggable).html() + "</li>");
ui.draggable.remove();
$(".drag").find(".card").draggable({
revert: "invalid"
});
}
});
CSS:
.card-container{
display: table;
}
.card-column{
display: table-cell;
min-height: 200px;
border: 1px solid #B6B6B6;
}
.card-row{
min-height: 200px;
display: table-row;
}
.card-column ul {
list-style: none outside none;
margin: 0 0px;
padding: 0px 0 0;
position: relative;
}
.card-column ul li{
background: none repeat scroll 0 0 #F6F6F6;
border: 1px solid #D0D0D0;
border-radius: 3px;
margin: 5px;
}
JSFiddle
Im using jQuery UI 1.8.6
How can I prevent other cards to move?
Cheers
In CSS add float:left to .card-column class
.card-column{
display: table-cell;
float:left;/*ADD THIS*/
min-height: 200px;
border: 1px solid #B6B6B6;
}

jQuery-ui Accordion height issue when embedded within a jQuery Tab

I have a jQuery tab, I have some tabs. I have a jquery-ui accordion with two panels, section 1 and section 2 in the first tab. Also another accordion with two panels in the second tab. For some reason, the panels' (divs within h3 tags) height for accordion on second tab are set to 0px and display:none and vertical scroll is appearing for both panels as i have seen with internet explorer debugger (see image attached in the link): http://snag.gy/6pmYd.jpg
The problem is only with the accordion on the second tab: panels are not resized to the tallest one. is it a bug of jQuery tab?
<style>
/* IE has layout issues when sorting (see #5413) */
.group { zoom: 1 }
</style>
<div id="tabs">
<ul>
<li>Components</li>
<li>Capsules</li>
</ul>
<div id="ComponentsTab">
<div id="accordion"> <!-- style= "width: 790px;" -->
<div class="group">
<!-- First Panel 'Add Component' -->
<h3>Add component</h3>
<div>
#using (Html.BeginForm("AddField", "Configure", FormMethod.Post))
{
<label id="NumberOfItems" for="amount">#Resource.ComponentNumberOfItems</label>
<input type="text" name="amount" id="amount" />
<div id="slider-range-max"></div>
<div id="componentId">
#Html.LabelFor(m => m.ComponentViewModel.SelectedCompTypeId, new { #id = "componentIdLabel" })
#Html.DropDownListFor(m => m.ComponentViewModel.SelectedCompTypeId,
Model.ComponentViewModel.CompTypeItems)
</div>
<div class="componentGroup">
<label id="NameCompLabel" for="NameComp">Name:</label>
#Html.TextBox("NameComp", null, new { #class = "textStyle" })
</div>
<div class="componentGroup">
<label id="DescCompLabel" for="DescComp">Description:</label>
#Html.TextBox("DescComp", null, new { #class = "textStyle" })
</div>
<div class="componentGroup">
<input id="submitAddComp" type="submit" value="#Resource.ButtonTitleAddComponent" />
</div>
}
</div> <!-- end first panel 'Add Component' -->
</div> <!-- end group -->
<div class="group">
<!-- Second Panel 'Filter' -->
<h3>Filters</h3>
<div>
#using (Ajax.BeginForm("Search", "Component",
new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "jqGrid",
OnSuccess = "showGrid()"
}))
{
<!-- Drop down list for component types -->
<div id = "componentTypeFilter">
#Html.LabelFor(m => m.ComponentViewModel.SelectedCompTypeId, new { id = "componentFilterLabel" })
#Html.DropDownListFor(m => m.ComponentViewModel.SelectedCompTypeId, Model.ComponentViewModel.CompTypeItems)
</div>
<!-- Apply filter button for components -->
<div id="ApplyFilterComponents" >
<input type="submit" name="_search" value="#Resource.CaptionComponentApplyFilter" />
</div>
}
</div>
</div> <!--end group -->
</div> <!-- end accordion -->
<!--
<div id="jqGrid">
#Html.Partial("../Grids/_ComponentGrid")
</div>
-->
</div> <!-- End First tab -->
<div id="OthersTab">
<div id="accordion2"> <!-- style ="width: 790px;" -->
<div class="group">
<h3>Add others</h3>
<div>
#using (Html.BeginForm("AddOthers", "Configure", FormMethod.Post))
{
<div id="itemId">
#Html.LabelFor(m => m.ItemViewModel.SelectedItemTypeId, new { #id = "itemIdLabel" })
#Html.DropDownListFor(m => m.ItemViewModel.SelectedItemTypeId,
Model.ItemViewModel.TypeItems)
</div>
<div class="itemGroup">
<label id="NameItemLabel" for="NameItem">Name:</label>
#Html.TextBox("NameItem", null, new { #class = "textStyle" })
</div>
<div class="itemGroup">
<label id="DescItemLabel" for="DescItem">Description:</label>
#Html.TextBox("DescItem", null, new { #class = "textStyle" })
</div>
<div class="itemGroup">
<input id="submitAddItem" type="submit" value="#Resource.ButtonTitleAddItem" />
</div>
}
</div>
</div> <!--end group -->
<div class="group">
<h3>Filters</h3>
<div>
#using (Ajax.BeginForm("Search", "Items",
new AjaxOptions
{
HttpMethod = "GET",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "jqGridItems",
OnSuccess = "showGridItems()"
}))
{
<!-- Drop down list of item types -->
<div id = "itemTypeFilter">
#Html.LabelFor(m => m.ItemViewModel.SelectedItemTypeId, new { id = "itemFilterLabel" })
#Html.DropDownListFor(m => m.ItemViewModel.SelectedItemTypeId,
Model.ItemViewModel.TypeItems)
</div>
<!-- Apply filter button for items -->
<div id="ApplyFilterItems" >
<input type="submit" name="_search" value="#Resource.CaptionItemsApplyFilter" />
</div>
}
</div>
</div> <!-- end group -->
</div> <!-- end accordion -->
<!--
<div id="jqGridItems">
#Html.Partial("../Grids/_ItemsGrid")
</div>
-->
</div> <!-- end second tab -->
</div> <!-- End tabs -->
SCRIPTS:
<script type="text/javascript" src="#Url.Content("~/Scripts/jquery-1.9.1.js")"></script>
<script type="text/javascript">
// -------------------------------------------------------------------------------------------------
// Slider functionality
// -------------------------------------------------------------------------------------------------
$(function () {
$("#slider-range-max").slider({
range: "max",
min: 1,
max: 255,
value: 1,
slide: function (event, ui) {
$("#amount").val(ui.value);
}
});
$("#amount").val($("#slider-range-max").slider("value"));
});
function showTabs() {
$("#tabs").tabs ();
};
$(document).ready(function () {
showTabs();
});
// Below makes tabs sortable (Their position can be altered)
$(function () {
var tabs = $("#tabs").tabs();
tabs.find(".ui-tabs-nav").sortable({
axis: "x",
stop: function () {
tabs.tabs("refresh");
}
});
});
$(function () {
function subscribe_accordion_to_hoverintent_event(accordionId) {
$(accordionId).accordion({
header: "> div > h3",
event: "click hoverintent"
});
}
subscribe_accordion_to_hoverintent_event("#accordion");
subscribe_accordion_to_hoverintent_event("#accordion2");
});
// Collapse content
$(function () {
function set_accordion_as_collapsible(accordionId) {
$(accordionId).accordion({
collapsible: true//,
//eightStyle: "auto"
});
}
set_accordion_as_collapsible("#accordion");
set_accordion_as_collapsible("#accordion2");
});
// Sortable functionality
$(function () {
function set_accordion_as_sortable(accordionId) {
$(accordionId).sortable({
axis: "y",
handle: "h3",
stop: function (event, ui) {
// IE doesn't register the blur when sorting
// so trigger focusout handlers to remove .ui-state-focus
ui.item.children("h3").triggerHandler("focusout");
}
});
}
set_accordion_as_sortable("#accordion");
set_accordion_as_sortable("#accordion2");
});
/*
* hoverIntent | Copyright 2011 Brian Cherne
* http://cherne.net/brian/resources/jquery.hoverIntent.html
* modified by the jQuery UI team
*/
$.event.special.hoverintent = {
setup: function () {
$(this).bind("mouseover", jQuery.event.special.hoverintent.handler);
},
teardown: function () {
$(this).unbind("mouseover", jQuery.event.special.hoverintent.handler);
},
handler: function (event) {
var currentX, currentY, timeout,
args = arguments,
target = $(event.target),
previousX = event.pageX,
previousY = event.pageY;
function track(event) {
currentX = event.pageX;
currentY = event.pageY;
};
function clear() {
target
.unbind("mousemove", track)
.unbind("mouseout", clear);
clearTimeout(timeout);
}
function handler() {
var prop,
orig = event;
if ((Math.abs(previousX - currentX) +
Math.abs(previousY - currentY)) < 7) {
clear();
event = $.Event("hoverintent");
for (prop in orig) {
if (!(prop in event)) {
event[prop] = orig[prop];
}
}
// Prevent accessing the original event since the new event
// is fired asynchronously and the old event is no longer
// usable (#6028)
delete event.originalEvent;
target.trigger(event);
} else {
previousX = currentX;
previousY = currentY;
timeout = setTimeout(handler, 100);
}
}
timeout = setTimeout(handler, 100);
target.bind({
mousemove: track,
mouseout: clear
});
}
};
</script>
CSS:
.elementStatus
{
visibility: hidden;
}
.image{
/*float: left;
margin-top: 2px;
padding-top: 1px;
padding-left: 10px;
width: 35px;*/
margin-top: 5px;
text-align: center;
vertical-align: middle;
}
.text{
/*float: left;
margin-top: 1px;
padding-left: 14px;
padding-bottom: 2px;
width: 35%;*/
font-weight: bold;
font-size: 1em;
text-align: center;
vertical-align: middle;
margin-bottom: 2px;
}
#accordion2 .ui-accordion-content
{
max-height: 400px;
overflow-y: auto;
}
#accordion, #accordion2
{
width: 790px;
padding-top: 10px;
margin-top: 10px;
margin-left: 0px;
margin-right: 0px;
}
#ComponentTypeFilterLabel
{
font-size: 1em;
margin-top: 11px;
float: left;
}
#componentTypeFilter, #itemTypeFilter
{
margin-top: 10px;
margin-left: 12px;
float: left;
}
#ApplyFilterComponents, #ApplyFilterItems
{
padding-left: 20px;
float: left;
}
#ApplyFilterComponents input, #ApplyFilterItems input
{
margin-top: 22px;
font-size: 1em;
}
#NumberOfItems
{
text-align: left;
width: 150px;
float: left;
margin-right: 1px;
padding-top: 5px;
font-size: 1em;
}
#amount
{
text-align: left;
color: #f6931f;
font-weight: bold;
border-top-color: currentColor;
border-right-color: currentColor;
border-bottom-color: currentColor;
border-left-color: currentColor;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
margin-top: 0px;
margin-left: 1px;
width: 555px;
padding-top: 5px;
padding-left: 5px;
padding-right: 1px;
margin-right: 1px;
}
#componentFilterLabel, #itemFilterLabel
{
font-size: 1em;
}
#componentId, #itemId
{
height: 55px;
font-size: 1em;
float: left;
text-align: left;
font-weight: 600;
}
#componentIdLabel, #itemIdLabel
{
margin-bottom: 5px;
height: 21px;
margin-top: 25px;/*0px; */
padding-bottom: 0px;
font-size: 1em;
}
#NameCompLabel, #NameItemLabel
{
margin-left: 0px;
margin-top: 25px;
padding-left: 14px;
font-size: 1em;
}
#DescCompLabel, #DescItemLabel
{
margin-left: 5px;
margin-top: 25px;
padding-left: 10px;
font-size: 1em;
}
#NameComp, #NameItem
{
float: left;
margin-left: 15px;
margin-top: 0px;
font-size: 1em;
}
#DescComp, #DescItem
{
float: left;
margin-top: 0px;
margin-left: 15px;
font-size: 1em;
}
#submitAddComp, #submitAddItem
{
margin-top: 40px;
margin-left: 15px;
font-size: 1em;
}
.componentGroup, .itemGroup
{
float: left;
}
.textStyle
{
width : 150px;
}
this cause to make visible vertical scroll bars in each panel that I do not want that.
so If I uncheck those attributes from ie dev tools (debugger) then all panels will be set to the height of the tallest panel that is what i want. So how to set it in the divs? with inline style or css?
ALMOST WORKING:
I have upated my script, now it is almost working. What I have done is to modify the code inside $(document).ready(...), see below:
$(document).ready(function () {
var tabs = $("#tabs").tabs({
activate: function (event, ui) {
$("#accordion2").accordion({
activate: function (event, ui) {
$(ui.newPanel).css('height', '100');
$(ui.newPanel).css('min-height', '100');
$(ui.newPanel).css('max-height', '400');
}
}); // End Accordion
} // End Activate tab
}); // End tabs
tabs.find(".ui-tabs-nav").sortable({
axis: "x",
stop: function () {
tabs.tabs("refresh");
}
});
});
The rest of code is kept the same as posted here above.
The problem now is the following: Initially first tab is active, and so first accordion shown with its first panel activated and expanded. Then when I switch to second tab, ONLY THE FIRST TIME, second accordion (accordion2) is show and its first panel activated, but the panel is not adjusting to its content: it is showing vertical scroll bar and i do not want that. Then If i switch to first tab and then again to second tab, then it works, accordion2 is activated and its first panel activated and shown, no vertical scroll bar is appearing and panel it is adjusting perfectly to its content. The problem is the first time i am switching from first tab to second tab where accordion2 is. So how to force panel for accordion2 to be adjusted to its content?
FINAL SOLUTION
$(document).ready(function () {
$("#accordion2").accordion({
header: "> div > h3",
event: "click hoverintent",
collapsible: true
});
var tabs = $("#tabs").tabs();
});
and in css file:
#accordion2 .ui-accordion-content
{
height: 100px;
max-height: 400px;
}
Please, do not downvote!
$("#DivName" ).accordion({
heightStyle: "content"
});
This is certainly what you and me are looking for. HeightStyle set to 'content' solved my issue.
The reason for height being set to 0 is because the other tabs are hidden and height gets calculated dynamically when accordion plugin is constructed. one way to solve the issue is use the tab activate event and construct the accordion only when the tab is active to the hight is set correctly. [JSFiddle]http://jsfiddle.net/8tBtR/
$(function(){
$( "#tabs" ).tabs({
activate: function( event, ui ) {
if((ui.newPanel.attr('id') === 'tabs-2') && (checkIfNotAccordion) )
{
$('#accordion2').accordion();
}
}
});
});

jquery-ui: drag from resizable content to output div

hi i don't know how to solve this issue, to resize div i use "overflow: hidden" but if i put this i can't drag to out of div (i can but is transparent), if I quit it and resize the div doesn't hides:
HTML
<div class="region">
dragg to me MADA FAKA
</div>
<div id="tabs">
<ul>
<li>tab-1</li>
<li>tab-2</li>
<li>tab-3</li>
</ul>
<div id="tabs-1">
<div class="destacado" title="destacado">
DRAGGABLE TO MADAFAKA 1
</div>
</div>
<div id="tabs-2">
<div class="destacado" title="destacado">
DRAGGABLE TO MADAFAKA 2
</div>
</div>
<div id="tabs-3">
<div class="destacado" title="destacado">
DRAGGABLE TO MADAFAKA 3
</div>
</div>
</div>
CSS
#tabs
{
position: fixed;
overflow: hidden;
width: 320px;
height: 150px;
padding: 0.5em;
border: 1px solid black;
z-index: 2;
}
.destacado
{
border: 2px solid black;
}
.region
{
width: 200px;
height: 200px;
border: 2px solid red;
}
JS:
$('#tabs').tabs();
$('#tabs').resizable();
$('#tabs').draggable();
$('.region').sortable(
{
connectWith: '.region',
items: 'div[title="destacado"]'
});
$('#tabs-1, #tabs-2, #tabs-3').sortable(
{
connectWith: '.region',
items: 'div[title="destacado"]'
});
jsFiddle without overflow: hidden: http://jsfiddle.net/hq9Pw/2/
jsFiddle with overflow: hidden: http://jsfiddle.net/hq9Pw/3/
finally solved with this:
connectWith: '.region',
appendTo: 'body',
containment: 'window',
helper: 'clone'

Resources