Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8146713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:05:54+00:00 2026-06-06T14:05:54+00:00

I have a small problem which i can’t seem to solve myself. Look at

  • 0

I have a small problem which i can’t seem to solve myself.
Look at this fiddle:JSfiddle

This is a basic example of the problem I have.
I have a large div which is a droppable area. Inside this droppable area are multiple other droppable areas.

The inner droppable area should walk trough its code when the element is dropped. Instead the code from the outer div seems to run.
Am i doing something wrong? The area around the divs should stay this way because elements can be placed here (not officially dropped).

I hope my question is clear enough, but I think the fiddler speaks for itself.

P.S. – resizing in this example isn’t functioning but is functioning in my development environment.


Rusty and Mark,
Thank you for your replies.

I’m sorry for the confusing resizer. I just removed that from the code.
New Fiddler

Just to clarify things. The box div is a container which has multiple images in it. I am trying to achieve the following:
http://postimage.org/image/qwhtik04f/
The grey dotted boxes are the dropbox2 div from my example.
The space around those drop boxes are dropbox div.

The space with the board is the only place where images may be dropped without anything happening.
The dragged images can snap back to the dropbox2 divs.
If the images are dragged onto the dropbox div, the images should revert.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:05:55+00:00Added an answer on June 6, 2026 at 2:05 pm

    Your code has this for the outer <div>:

    $("#dropbox").droppable({
        drop: function(event, ui) {
           ui.draggable.draggable( 'option', 'revert', true );
        }
    });
    

    This says to set the revert option to true when you drag into the outer <div>. However, when you drop in the smaller <div>, the option is still set to true. All you need to do is change the revert value on your draggable element after a successful drop in your inner <div>:

    $("#dropbox2").droppable({
        drop: function(event, ui) {
            ui.draggable.position( { of: $(this), my: 'center', at: 'center' } );
            // Add this line
            ui.draggable.draggable( 'option', 'revert', false );
        }
    }); 
    

    Update:

    Mark pointed out that my solution doesn’t stop the propagation of the event to the parent container. As his answer shows, you need to add greedy: true in your initial options. The jQuery documentation says:

    If true, will prevent event propagation on nested droppables.

    That sounds like what you’re looking for. You still need to change the revert property on your draggable, since greedy is only set on your droppables and won’t affect your draggable reactions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small problem which I can't seem to find a solution to.
i have a small problem here which i cannot fix,This post goes through but
Dear community members, I have a small problem, which involves a text input field
Problem: Have made a small mail program which works perfectly on my developer pc
I have a small problem. My app has a database which stores lazy loaded
I am teaching myself some Python and I have come across a problem which
I have a small problem, which I think it will be easy for you
I've got a seemingly small problem using LaTeX, which i can't find the answer
I have a small multiplayer Flash game in which you can display a player
I got a small problem that I can't figure out. I have a superclass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.