悬停在图像的不透明部分 [英] Hover only on non-transparent part of image
问题描述
有没有办法只让图片的不透明部分触发鼠标悬停事件?
Is there any way to make only a non-transparent portion of an image to trigger mouse-over event?
如果鼠标移动到透明区域,鼠标悬停应该被触发,并且脚本应该监听图像下方图层上的任何鼠标悬停事件。
If the mouse travels to the transparent area, the mouse-out should be triggered and the script should listen for any mouse-over event on a layer underneath the image.
这是可能吗?感谢您的任何输入。
Is it possible? Thanks for any input.
编辑:
我希望不使用闪光灯。
I am looking to do this without using flash.
推荐答案
您可以使用具有旧式< map>
和< area>
标记。区域标记可以触发javascript鼠标事件(示例使用的是此jQuery插件: jQuery maphilight )。
但是,没有很好的方法来动态创建地图 - 您必须手动创建,或者调用服务器端服务来映射它。
You can use an image with the old-fashioned <map>
and <area>
tags. An area tag can trigger javascript mouse events (an example use is this jQuery plugin: jQuery maphilight).
However, there is no good way to create the map dynamically - you'll have to do it manually, or call a server-side service to map it.
这篇关于悬停在图像的不透明部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!