我想让我的菜单动起来。但是什么都没有发生,我在控制台中只收到以下错误:“解析‘background-position’的值时出错”。
你能帮帮我吗?
CSS:
nav li a {
display:block;
height:96px;
width:124px;
color:#818080;
text-align:center;
text-decoration:none;
padding-top:60px;
background:url(../img/n1-hover.gif) 0 -146px no-repeat;
}JavaScript
$(document).ready(function() {
$('.menu a').hover(
function(){$(this).stop().animate({backgroundPosition:'0px 0px'}, 800, 'easeOutBounce')},
function(){$(this).stop().animate({backgroundPosition:'0px -146px'}, 600, 'easeOutBounce')});
}); 我忘了提一下,我正在使用插件JQuery Easing。
发布于 2011-11-24 02:01:43
将px部件从背景位置移走,它应该可以正常工作。尝尝这个
$(document).ready(function() {
$('.menu a').hover(
function(){$(this).stop().animate({backgroundPosition:'0 0'}, 800, 'easeOutBounce')},
function(){$(this).stop().animate({backgroundPosition:'0 -146'}, 600, 'easeOutBounce')});
}); https://stackoverflow.com/questions/8246871
复制相似问题