我目前正在尝试在所有浏览器中正确渲染一些jQuery悬停效果。目前,Firefox,IE,Opera都在做他们应该做的事情。但是,Safari和Chrome不会。jQuery .hover无法在Safari或Chrome中工作
的代码看起来是这样的:
<div id="button1">
<div id="work_title" class="title_james">
WORDS
</div>
</div>
<div id="button2">
<div id="work_title" class="title_mike">
MORE WORDS
</div>
</div>
和脚本实现它看起来像这样
<script>
$(function() {
$("#button2").hover(
function() {
$("#james").css('z-index', '100')
$(".title_mike").css('width', '590px')
}, function() {
$("#james").css('z-index', '')
$(".title_mike").css('width', '')
});
});
$(function() {
$("#button1").hover(
function() {
$(".title_james").css('width', '785px')
}, function() {
$(".title_james").css('width', '')
});
});
</script>
我试图把它做的是改变CSS样式上悬停两个元素在两个大面积的文字..
我试过了mouseenter.addClass和mouseleave.removeClass的东西,并没有工作..所以当我得到这个工作在Firefox中我是一个LL快乐......然后我做了跨浏览器的检查,我得到了再一次伤心..
您可以在现场看到它在行动: http://roboticmonsters.com/who
,这样您就可以给予好评,帮助解答,并接受一个答案的解决方案,以显示您欣赏到其他用户。 –