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 7517077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:19:59+00:00 2026-05-30T01:19:59+00:00

I have an accept function defined on the red box in the fiddle. Expected

  • 0

I have an accept function defined on the red box in the fiddle.

Expected

Accept runs once when draggable enters it.

Actual

Accept seems to run once when drag enters, once when it leaves, and many, many times if I drag the yellow box to left of the HTML screen.

In action: http://jsfiddle.net/bjJv8/

I am not asking how to avoid this; I can write my own revert functionality, but the main reason it seems I have to is because this doesn’t seem to work right.

To see what I’m saying, drag the yellow box to the left of the screen. You’ll see the accept counter increments every drag pixel. What is going on? Why does accept run so many times when nothing is dragged onto it?

  • 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-05-30T01:20:00+00:00Added an answer on May 30, 2026 at 1:20 am

    Accept can be either a selector (typically a class) describing the items that can be dragged into the droppable, or a function that will return true if the object passed to it can be dropped on the target.

    Inconveniently, it seems the accept function is run on every drag event (start, stop, enter, leave), as well as on drags along the edge of the page. If your accept function is going to get quite large, you might want to put it in the drop/stop method, and revert if it is an invalid drop.

    Alternately, you could start off the accept function by determining whether the item has been dropped or is being dropped, and only do the heavy lifting in that case (otherwise return true, see note below).

    Side note: if accept returns false on drag start, it doesn’t run for any of the other events (except dragging along the edge of the page).

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

Sidebar

Related Questions

I have a function that can accept any number of arguments... const getSearchFields =
I have defined a boolean Jess function that accepts a lambda, as follows: (deffunction
When a C function does not accept any arguments, does it have to be
I have a class whose function defined like this. My intention is to send
As Ocaml does not accept function overloading, sometimes I have to define some similar
In my function, in order to accept an array of values I have to
suppose I have a function which accept const reference argument pass, int func(const int
I have a function that accepts an anonymous function as an argument and sets
I have a function that accepts a char* as one of its parameters. I
I have a function that accepts a class (not an instance) and, depending on

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.