Share Posted October 29, 2015 Hi everyone, I know i can go about this a different way and make it work but i was still wondering what the answer would be to this questions i have. I'm trying to get the id of the element in the hit test that the target is going over. Ex: if (this.hitTest("#circle1", "50%")) { } How would i access and get the value of #circle1 inside the hittest if statement? this.target is the object being dragged, but i want to know what i could use to get the "circle1" value? I'm trying to get html info from that circle1. Thanks! Brad Link to comment Share on other sites More sharing options...
Share Posted October 29, 2015 Hi TopGUN121 pls try like this : var Targets = document.querySelectorAll('.Targets'); Draggable.create('.Draggable',{ onDragEnd:function(){ for(var i=Targets.length; i--{ if(this.hitTest(Targets[i],'50%')){ console.log(Targets[i].id) } } } }); 4 Link to comment Share on other sites More sharing options...
Author Share Posted October 29, 2015 This worked perfectly for my needs! thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now