简体   繁体   English

如何在悬停过程中使javascript忽略透明图像区域并单击

[英]how to make javascript ignore transparent image areas during hover and click

i have located a number of posts on this topic, but none of them seem to address my specific need. 我在此主题上找到了许多帖子,但似乎都没有解决我的特定需求。 my ultimate goal is to reproduce Nike ID Flash-based customization using html5,css3, and javascript. 我的最终目标是使用html5,css3和javascript重现基于Nike ID Flash的自定义。

my immediate knee-jerk reaction was to slice up an image into a number of irregularly-shaped image slices. 我立即下意识的反应是将图像切成许多不规则形状的图像片。 then use some image editing software (photoshop, etc) to create additional copies of each image slice, each bearing a different color profile. 然后使用某些图像编辑软件(photoshop等)为每个图像切片创建其他副本,每个副本具有不同的颜色配置文件。 finally, i would position all images slices in such a way where they would recompose the original image, sort of like a jigsaw puzzle. 最后,我将所有图像切片放置在重新组合原始图像的位置,就像拼图游戏一样。

and that is where i hit a wall. 那就是我碰壁的地方。 the very nature of each such image slice's irregular shape would result in some of its area(s) to be transparent. 每个此类图像切片的不规则形状的本质将导致其某些区域透明。 what makes it more complicated is the fact that some of those transparent areas are bound to reside above the active slice areas of the underlying image slices, thereby preventing the latter from registering the hover and click mouse actions. 更复杂的是,这些透明区域中的某些区域必定会驻留在基础图像切片的活动切片区域上方,从而防止后者注册悬停和单击鼠标动作。 granted there are a lot of posts out there on how to make javascript ignore the transparent areas. 当然有很多关于如何使javascript忽略透明区域的文章。 however, i have yet to come across a solution where a transparent area would truly behave transparent, thereby allowing for the underlying image to register mouse interactions. 但是,我还没有遇到一种解决方案,其中透明区域将真正表现为透明,从而允许基础图像记录鼠标的交互作用。

so the question is if there is a way to make transparent areas truly transparent? 所以问题是是否有办法使透明区域真正透明? or am i going all wrong about is? 还是我会全力以赴?

any suggestions would be greatly appreciated! 任何建议将不胜感激! thank you. 谢谢。

This can be achieved with <map> and <area> tags. 这可以通过<map><area>标签实现。

http://www.image-maps.com/ allows you to upload an image and generate the HTML code for you. http://www.image-maps.com/允许您上传图像并为您生成HTML代码。 All you need to do is to drag the certain areas. 您需要做的就是拖动某些区域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM