jQuery UI Bounce(双图像)

时间:2013-03-24 05:55:55

标签: javascript jquery css user-interface bounce

第一次在这里发帖,如果我有任何标记问题,请原谅我。我不习惯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>

1 个答案:

答案 0 :(得分:2)

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

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

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

div {
    width: 32px;
    height: 32px;
}