Jump to content
Search Community

assign draggable.hitTest to div

Liquid test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi, this may be my first time, but i come form flash and twenMax era.

 

This time i'm at the end and i'm about to give up.

 

im creating squares(as div with own id and same class) put them into div so they do span on entire width and height of that div.

its 1250 squares (there is another div above with text) and so far only hitTest can find underlaying elements, since they are covered with text which need scroll and clicks on links so i can't use pointer-events: none;

 

Now, iterating through 1250 items in array to highlight square which is under mouse cursor is computationaly intensive but works.

 

So i was wondering, instead iterating can i assign hitTest to those squares and when mouse enters its coordinates it will respond to that event.

yeah, i know onMouseEnter and onMouseOut doe's not work since we do have element over it.

 

in this example div of id "oko" follows mouse and is a hitTest Detector.

 

Any other method or suggestion is appreciated to make it work, basicly what i need is to get div id under ursor to animate it's properties and when mouse is not over that square anymore i need to restore default look to square that was highlighted.

 

Thank you for awesome years with gsap,twenmax and i hope for more to come.

 

demo here

 

http://liquid.pl/newsx.html

 

Best Regards

Liquid

Link to comment
Share on other sites

  • Liquid changed the title to assign draggable.hitTest to div
  • Solution
13 hours ago, liquid@liquid.pl said:

i come form flash and twenMax era.

Welcome!

 

13 hours ago, liquid@liquid.pl said:

instead iterating can i assign hitTest to those squares and when mouse enters its coordinates it will respond to that event.

yeah, i know onMouseEnter and onMouseOut doe's not work since we do have element over it.

I'm not able to see that URL and without a minimal demo, it's hard for me to advise you but perhaps you want to look at this: 

https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint

 

If you still need some help, would you mind putting together a minimal demo (like in CodePen) please? That will significantly increase your chances of getting a quality answer. 👍

  • Thanks 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...