Non-rectangular Image Button

24 views
Skip to first unread message

amer...@gmail.com

unread,
Jul 1, 2017, 1:52:26 PM7/1/17
to Google Web Designer beta
I want to create a rollover effect such that when a user hovers over an image it does an image swap. The Image Button component does this, but I wonder if it's possible to create one that is not a rectangle so that it interacts more precisely with an image. I'd like it to be more of a tall trapezoid shape.

I played around with the CSS of the component, but was only able to get cosmetic changes and not actual changes in how it responds to the mouse.

yor...@mobiusads.com

unread,
Jul 6, 2017, 10:44:10 AM7/6/17
to Google Web Designer beta
Hi,

Every element in HTML is rectangle based, so my guess is: no you can not. Maybe there are options to play with the z-index, but I think it can lead to lots of bugs.

Yordan

San Khong

unread,
Jul 10, 2017, 12:16:15 PM7/10/17
to Google Web Designer beta
You can use events to do the image swap (turn visibility on and off on mouseover) and also set events to handle the click so you don't need to use the image button component in this case.

Thanks,
San
Google Web Designer team


amer...@gmail.com

unread,
Jul 10, 2017, 2:45:38 PM7/10/17
to Google Web Designer beta
I did try that but there is still the problem of the original image being rendered as a rectangle even if it isn't one. ie my image is a tall trapezoid but when you hover over the blank spaces just to the sides of it it still does the image swap.

I was able to solve it by placing tilted transparent rectangles over the blank spaces, and making sure to layer them on top of the trapezoid shaped image so as to block the hover effect on the areas where I didn't want it. It's kind of a clumsy solution but it works.

Reply all
Reply to author
Forward
0 new messages