【发布时间】:2012-10-10 14:07:35
【问题描述】:
我有一个代码,一个简单的悬停效果,在 jQuery 1.4 中运行良好,但在 jQuery 1.7 中无法运行
代码如下:
jQuery(document).ready(function() {
/* When a thumbnail is hovered over do shine */
$('.large_thumb').hover(function() {
$(this).find(".large_thumb_shine").css("background-position", "-167px 0");
$(this).find(".large_thumb_shine").stop().animate({
backgroundPosition: '167px 0'
}, 600);
}, function() {
$(this).find(".large_thumb_shine").stop().animate({
backgroundPosition: '167px 0'
}, 600);
});
});
应该怎么做:
在bg-position 上处理onmouseover 的内容上移动一个透明的类似闪亮的PNG。该效果不应在 onmouseout 上重复,因此是第二个函数。
由于某些原因,这个超级基本的代码在最新的 jQuery 1.7 中无法使用,但在 1.4 中仍然可以使用。
我已阅读文档并且似乎使用了正确的方法,悬停。我的代码中的问题似乎在哪里?
编辑:
jsfiddle
【问题讨论】:
-
也许你会在这里找到答案:stackoverflow.com/questions/10533509/…
-
所以bg位置不能用1.7动画?
-
从 1.4 跳到 1.7 有很多不同之处。 1.6 版破坏了很多东西。
-
知道如何在 1.7 中实现同样的功能吗?
标签: jquery hover jquery-hover