兼容ie6伪类hover的javascript解决方法
javascript部分
//先判断是否是ie6
if(/msie|MSIE 6/.test(navigator.userAgent)){
// search for selectors you want to add hover behavior to
$('.jshover').hover(
function(){
$(this).addClass('over');
},
function(){
$(this).removeClass('over');
}
}
或者:
<!--[if IE 6]>
Special instructions for IE 6 here... e.g.
<script>...hook hover event logic here...</script>
<![endif]-->
把样式.jshover加到任何想出现hover效果的元素即可,并且定义css
css:
ul li:hover, ul li.over { hover之后的效果样式 }

浙公网安备 33010602011771号