I'm using jQuery.event.drop by ThreeDubMedia (here) to build a drag and drop application. If i read right, there is only the way to add global options.
I have different usecases for this plugins, requiring different configs.
e.g. In one part of the application, i am using the multi option
$.drop({
multi: true
});
On the same page, just in another div, i need to disable multi and set mode: true - using a config like that
$.drop(
{
mode:true,
multi: false
});
When executing this piece of code, the old config is rewritten and the multi drag and drop won't work anymore - unless i overwrite it again.
Any ideas on how to use multiple configs?
Came up with a little "hacky solution". I'm now using the drag "start" event to replace the config to the currently needed for the drag & drop action.
Something like this:
$("#myel").drag("start",function( ev, dd ){
// Replace config
$.drop({
multi: true,
mode: "overlap",
});
// ...
})
And on the other drag binding:
$("#myel2").drag("start",function( ev, dd ){
// Replace config
$.drop({
multi: false,
mode: true,
});
// ...
})
Not very beautiful but at least it works. If you have other solutions for this, please share!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With