yoel
yoel

Reputation: 409

css : li hover doesn't work in internet explorer 6

here is the code : http://jsfiddle.net/yuliantoadi/hMr7h/

if you try to hover the 'test 2' link, the dropdown menu will appear. the problem in IE 6, any idea how to make this dropdown menu work in IE 6?

Upvotes: 2

Views: 1988

Answers (3)

vcsjones
vcsjones

Reputation: 141638

In IE 6, :hover only works on a tags for CSS. If you want hover effects for IE 6, they'll have to be done in Javascript.

Upvotes: 3

Austin Hyde
Austin Hyde

Reputation: 27436

That's because IE 6 (and 7, if my memory serves) doesn't support the :hover pseudo-class on anything but a link.

You can, however, emulate the behavior with a bit of JavaScript (not using jQuery, unlike choise's answer):

var element = document.getElementById('someid'); // I'm leaving this part up to you.
element.onmouseover = function (e) {
    element.className += ' hover';
};
element.onmouseout = function (e) {
    elemen.className.replace(' hover','');
};

Upvotes: 0

choise
choise

Reputation: 25244

you could use some JS to work around.

jquery sample:

$(function(){
    $('.link ul li').hover(
        function(){
          $(this).addClass('hover');  
        },function(){
            $(this).removeClass('hover');
    });
});

http://jsfiddle.net/hMr7h/1/

Upvotes: 1

Related Questions