Problems with JQuery's Droppable Tolerance 'fit' feature when using the same size divs
I'm just wonde开发者_Python百科ring if anybody else can manage to get the tolerance:'fit' option to work when using the 'droppable' feature in jQuery's UI?
I want to call a function only when the draggable div is dropped perfectly onto a droppable div. Both divs are the same size and I'm using snapMode:outer to help the end user.
I simply cannot get it to work with 'fit'. Works perfectly with 'intersect'.
Would really appreciate some help.
Thanks Chris
I stumbled over the same problem and it seems that for the time being you need to patch jquery-ui to make it work.
The patch is extremely simple and obvious and is described in the following jquery-ui bug report: http://dev.jqueryui.com/ticket/5689
I have no idea if this is really a bug or a "feature", though.
For those using the jQuery UI module in Drupal 6, you can fix it manually:
- Go to /sites/all/modules/jquery_ui/jquery.ui/ui/minified
- Find the file "ui.droppable.min.js" and make a backup of it (just in case something goes wrong).
- Open the original ui.droppable.min.js and search for the text "fit" (with the quotes).
- Change the line that says
return(F< D&&C< B&&N< L&&K< J); (spaces on purpose, not in the original line)
to
return(F<=D&&C<=B&&N<=L&&K<=J);
and save the changes. - Done, enjoy.
精彩评论