JQuery Draggable containment issue, cannot drag elements outside of parent div

I have a very simple image manager like:

<div id="container">

    <div id="draggable-images">
        <img class="images" src="image1.jpg" />
        <img class="images" src="image2.jpg" />
        <img class="images" src="image3.jpg" />

    <div id="droppable-area>



And jQuery to go with it:

        $( ".images" ).draggable({ containment: "#container" });
        $( "#droppable-area" ).droppable();


And this is the CSS:

#draggable-images {

.images {


The images are dragged, but they won't go out of their parent div no matter what the wrapper is set to (even tried to set it to the window).

Does anyone know how to get it to work, or why it doesn't work?

I set z-index high to make sure this is not a problem. I also tried making the #draggable-images

div without scrollbar, that didn't work either.

It seems to work like a jQuery site , can't figure out what I'm missing.


source to share

3 answers

$('images').draggable({ appendTo: 'body' });




Remove overflow-x:hidden

from #draggable-images

. I faced similar issue too.



  • check your html, there is something wrong with it.
  • remove the overflow styles of the parent
  • Z-index? necessary?




All Articles