2

第一次在这里发帖,如果我有任何标记问题,请原谅我。我不习惯用 SOF 框架来写帖子。

我试图让一些社交图标在悬停时在我的网站上弹跳。我从 jQuery UI 获取代码进行测试并进行了一些小的编辑,但是我遇到了在页面上显示双图像的问题。当鼠标悬停在图像上时,它会弹跳,但从弹跳图像后面可以看到一个副本。如果我在弹跳会话期间将鼠标移开并快速将鼠标悬停在图标上,它会正确弹跳隐藏图像。

那么我怎样才能强制它始终将图像隐藏在后面呢?

<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<style type="text/css">
div { width: 32px; height: 32px; background-repeat:no-repeat; background-image: url(http://www.liquidclubs.com/assets/img/icon-fb.png); border: position: relative; }
</style>
<script>
$(document).ready(function() {

$("div").mouseenter(function () {
  $(this).effect("bounce", { times:3 }, 350);
});

});
</script>
</head>
<br><br><div></div>
</body>
</html>
4

1 回答 1

2

因为您将图像定义为背景图像。

http://jsfiddle.net/UQTY2/33/

<div> <img src="http://www.liquidclubs.com/assets/img/icon-fb.png" /></div>

div {
    width: 32px;
    height: 32px;
}
于 2013-03-24T06:31:31.213 回答