Jump to content
Search Community

AddEventListener on visible part of transparent png

DeltaFrog test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

Hi All,

 

Does anyone know how to target the visible part of a .png with a listener instead of its containing div?  I want the mouse over function to run when the mouse is over the visible part of the .png instead of the square div its in.  

 

I tried this path and it worked but the transparent part of the png still activates the listener.   Id also like to apply a glow to the PNG so I don't have to swap in another image.  Can GSAP do glows?  Thoughts?   :D

 

document.querySelector("#largeShipID > img").addEventListener('click', function(){

 

See the Pen QWaepXJ by deltafrogcraft (@deltafrogcraft) on CodePen

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...