Skip to content

ability for 'acceptFrom' to accept a function as an argument #643

Open
@mrichardsdev

Description

@mrichardsdev

I came across a need to be able to decide if a specific item should be accepted or not, with jQuery UI, it can be done with a function on 'accept' option which for me, works perfect, the only piece of jQuery UI i use is sortable and that has bugs and looks to no longer be maintained so I wanted to use this library.

but that functionality is not available, so I figured I would see if I can hack that functionality into html5sortable (which I am really loving btw)

You will have to excuse me as I am a bit of a novice and do not know how to use git or buildtools.

I modified _listsConnected to accept destination and dragging instead of destination and origin (origin = dragging.parentElement), that way the user supplied function can be passed the item being dragged for evaluation.

HERE is a codepen with a working example:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions