Drag and drop not fully working


(Jonathan Hart) #1

I’m adapting some drag and drop code from a demo I found on the forums for a project at work- it runs well except I can’t get the opacity of the target element to revert back to 1 when a drag element is not over the target. It stays semi opaque. Could anyone explain the fault in my (very crude) adaptation. Apologies in advance for not fully crediting the code, if anyone knows who made it, I’ll add a credit to the project.

The issue is with scene 5.2 draft- the js function is called checkDrop() and also required the js file hitcheck-1.js. It’s all packaged in the project. Hope someone can help- thanks in advance…

lrc-eng-jd-ambitious-vocab.hype.zip (1.2 MB)

Jon


(Hans-Gerd Claßen) #2

make var droppables a collection rather than single element … this should do the job :slight_smile:


(Jonathan Hart) #3

Thanks- added a class and then used the classname directly in place of element.id from the original code and it worked.

var droppables = hypeDocument.currentSceneElement().getElementsByClassName(‘droptarget’);

Was the demo your code Hans?- if so works really well, small and efficient.

Jon


(Hans-Gerd Claßen) #4

nice that the hitextension works for you :slight_smile:
be aware that is only 100% correct for circles which it was made for …