Border-radius and :hover state area issue

放肆的年华 提交于 2019-12-04 19:17:07

Well, you can use SVG and pointer-events:

https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events?redirectlocale=en-US&redirectslug=CSS%2Fpointer-events

Or just use SVG, maybe with some framework like Raphäel.

Or maybe play with a map, let me try that...

http://jsfiddle.net/coma/nawAE/10/

HTML

<img class="div" src="http://images2.wikia.nocookie.net/__cb20100822143346/runescape/images/2/21/1x1-pixel.png" usemap="hack"/>

<map name="hack">
    <area shape="circle" coords="200,200,200" />
</map>

JS

$('area').hover(function(event) {

    $('img.div').toggleClass('hover');

});

LOOK MOM, NO JS:

http://jsfiddle.net/coma/nawAE/12/

.div {
    display: block;
    font-size: 0;
    width: 400px;
    height: 400px;
    background-color: red;
    border-radius: 50%;
}

map:hover + img {
    background-color: blue;
}

More of that:

http://jsfiddle.net/coma/nawAE/16/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!