Failed to implement overflow hidden to DIV - javascript

Please take a look at this link. This draggable DIV failed to stay within the dashed DIV? Tried setting overflow: hidden at dropzone but the draggable DIV still going out of it instead of hiding it?

You need to use the containment parameter of the draggable plugin:
$('#innerDropzone').draggable({
containment: "parent"
});
Example fiddle
parent is the setting here, although you can provide a selector for any required element:
$('#innerDropzone').draggable({
containment: "#dropzone"
});

Related

drag and drop from master to detail view in sapui5

I would like to enable drag and drop within an sapui5 app. To do so I'm using the jQuery draggable and droppable widgets. Whenever I'm dragging an element from the master view to the detail view or vise versa the dragged element is hiding behind the other view. The drop is still recognized, the element is just don't show up. Basically both views are just div's. It could have something to do with the overflow property but I'm not getting any sense into it.
I'm using those parameters on my draggable function:
draggable({
helper: "clone",
cancel: true,
cursor: "pointer",
stack: "
})
Here's a sample jsbin: http://jsbin.com/werewuf/4/edit?html,output
As the sapMNav sapMSplitContainerMaster sapMSplitContainerMasterVisible element having overflow : hidden property, any child of this parent can not be seen visible out of this container.
Set 'overflow' : 'visible' for parent element and also for dragButton.$().parent().css("overflow-y", "visible").css("overflow-x", "visible");
$('.sapMSplitContainerMasterVisible').css('overflow', 'visible');
JSBin Demo

Stop the dragable event when this related div tag reached 100%?

I was tried to drag the div (class = scale_roll) tag by dragging the another div (class =scale_cap).
When the div scale_cap is dragging it's related scale_roll div tag also move.
But my problem is scale_cap dragging cann't stop when the scale_roll div tag was reached 100%.
I want to don't drag the div tag after the visible area. or i want to drag only the 100%.
Js Fiddle
First of all you fully read the Draggable. jQuery have the option for add the handle to the div.
So you don't work hard for add the handle to the drggable element.
create the handle <div> inside the draggable div. Then add and use this
$( ".scale_roll" ).draggable({
axis: "x",
containment: 'parent',
handle:'.scale_cap',
});
Working fiddle

Draggable element disappears in div

Trying to create a draggable div, but instead of it dragging into the droppable div and snapping into it, the draggable div just disappears when dragged. As seen here the div begins to disappear and still appends. I thought it might be a containment issue
$('.sorting').draggable({containment: 'parent', cursor:'pointer'});
When I changed the containment to parent from window the draggable div stays within as seen here. Not understanding why the draggable div disappears and does not enter the droppable the box like I want. I am sure there is something I am not understanding or seeing that probably needs to be pointed out. I would also be very appreciative to know why this happens and any other tips one may have.
Your draggable ul element disappears because of the overflow attribute of the .mousescroll class.
Replacing the css with
.mousescroll{
float: left;
}
.mousescroll:hover {
}
fixes your problem.

jQuery sortable container scroll div with overflow auto

I have been pulling my hair out trying to make this work.
I have two connected sortables, defined like so:
var sortlists = $("#List1, #List2").sortable(
{
appendTo: 'body',
tolerance: 'pointer',
connectWith: '#List1, #List2',
revert: 'invalid',
forceHelperSize: true,
helper: 'clone',
scroll: true
});
Here is a link to an example of jsfiddle
Because of the page setup, both sortables are being contained in div's with overflow: auto they are also wrapped in parent containers with overflow set to hidden. For arguments sake, lets say there is no way around that.
Is there a way to make the container element scroll when the helper is being positioned towards the lower or upper edge of the container?
Any help would be appreciated!
With helper:'original', I get the scrolling behaviour you seek, (in Opera 11.61).
forked fiddle
Edit: Here's a version of the fiddle with "ganged-scrolling"
I think this is what you want. Drag from div (with scrollable) to div (with scrollable) without the dragged item appearing behind the div.
http://jsfiddle.net/nURN5/1/
.document.body.appendChild //required to add code with link...
The next best approach would be to actually drag a clone of the item...
The forked fiddle with "ganged-scrolling" unfortunately exhibits the very nasty side effect of constraining (visually) the selected item to it's own div.

Combining revert with jQuery draggable/droppable

I'm using the drag and drop plugin with jQuery UI. I'd like to make it so that the draggable container can only be dragged and dropped on the container. In the demonstration:
http://jqueryui.com/demos/droppable/#revert
It has 2 options. One is to revert when it drags to the container, the second is to revert when it isn't dragged to the container.
Is there a way to combine these two? I don't want to be able to drag the #draggable container anywhere where there isn't a #droppable container.
As stated above, I found the solution by adding :
$('#draggable2').remove();
$('#draggable').draggable({ revert: true });

Categories

Resources