开发者

Hover doesn't work in IE [duplicate]

开发者 https://www.devze.com 2023-03-01 04:32 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: img:hover not working in ie
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

img:hover not working in ie

.answer_button
{
    background:url(images/answer.png) no-repeat;    
    width: 160px;
    height: 30px;   
    border: none;
    margin-left: -8px;
    cursor: pointer;
}
.answer_button:hover
{
    background:url(images/answer_hover.png) no-repeat;    
    width: 160px;
    height: 30px;   
}

What is wrong开发者_StackOverflow中文版 with this code? It works everywhere except IE. Thank you.

P.S. If you know IE bugs well, please help me to not go crazy and help me here either: Long polling jQuery doesn't work in IE


IE's hover detection differs a bit from WebKit/Gecko browsers. Check out the hoverIntent jQuery plugin which normalizes some of the behavior.


Older versions of Internet Explorer do not support :hover except on links. (This behaviour may persist in newer versions if you fail to have a Doctype that triggers Quirks mode (I'm not certain about this as I haven't had a reason to touch Quirks mode for many, many years).

I'm guessing you are using JavaScript to bind a click handler to some other element. Use a link instead, that will have the added bonus of being accessible without a pointing device (so people who navigate with a keyboard, breath switch, etc will be able to access it).


In IE, hover only works for anchors (<a>)

0

精彩评论

暂无评论...
验证码 换一张
取 消