The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Drag and drop sentences

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #242163

    I’ve used a drag and drop plugin before and it got the job done. On a different project I need something similar again but I’m wondering if it can be refined/simplified at all. Here’s a CodePen example of what I’ve used before:

    It’s actually pretty much exactly what I need this time. The problem is I have several ‘quizzes’ on each website and it could (will) get very hard to manage. Having to add javascript for each word I use.

    I was wondering is there a way, maybe using the data- attribute where a class of word-1 would only be accepted by data-accept="word-1 for example? I’ve tried playing around with this but I’m not having much luck.

    Another aspect would be to get the width of the draggable word and apply it to relevant droppable area – that’s in the current CodePen example.

    Hope someone can help with this, can’t see the wood for the trees at the minute!

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.