如何显示图像地图区域的轮廓(html、javascript)?

发布于 2024-12-09 19:57:21 字数 584 浏览 1 评论 0 原文

如果您快速浏览一下下面的两个链接,您会发现大多数人都希望消除图像上地图区域周围的轮廓。我发现这种情况仅发生在 MAC OS X 平台上。

删除图像地图区域上的轮廓

如何摆脱单击时图像地图区域的边框轮廓(仅限 OS X Chrome)

但是,我想要做的是在多个浏览器中显示轮廓并更改其颜色和宽度。我尝试过但无济于事。我为 id 创建了一个样式。没用。我尝试使用一个类,但没有成功。我设置了内联样式,但也不起作用。顺便说一句,我在地图和区域标签上都尝试过。

截至目前,我使用 gif 在单击时为该区域设置“边框”。但如果我可以利用内置的形状属性来突出显示单击的区域,事情就会变得容易得多。

非常感谢您的帮助。

If you take a quick look at the two links below, you'll see most people want to get rid of the outline around the area of a map on an image. I see this occurs on the MAC OS X platform, exclusively.

Removing outline on image map area

How do I get rid of this border outline for my image map areas when clicked (OS X Chrome Only)

However, what I want to do is show the outline in multiple browsers and change it's color and width. I tried but to avail. I created a style for an id. Didn't work. I tried using a class and that didn't work. I set an inline style and that didn't work, either. And I attempted it on both the map and area tags, by the way.

As of now, I use a gif to "border" the area when clicked. But it would make things so much easier if I could take advantage of the built-in shape attribute to highlight the area clicked.

Thank you very much for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尬尬 2024-12-16 19:57:21

旧版本的 Internet Explorer 不支持区域轮廓的 CSS。您可以通过阻止 mousedown 事件的默认处理来解决此问题。如果使用 jquery,类似的东西

$('area').bind('mousedown',function(e) {
    e.preventDefault();
});

会处理页面上的所有图像映射。

另请看看我的插件: http://www.outsharked.com/imagemapster 这将让你轻松处理鼠标悬停和单击事件的轮廓(和其他)效果。

Older versions of Internet Explorer do not respect CSS for the area outlines. You can solve this by blocking the default handing of the mousedown event. If using jquery, something like

$('area').bind('mousedown',function(e) {
    e.preventDefault();
});

would take care of it for all image maps on the page.

Also take a look at my plugin: http://www.outsharked.com/imagemapster which will let you easily handle outline (and other) effects on mouseover and click events.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文