我有這樣的代碼:jQuery - 動畫不能正常工作?
function move() {
$(document).mousemove(function(e){
var x = e.pageX;
$('.linkHover').animate({'right': '=' + x + 'px'}, 'slow');
});
}
和HTML是:
<div style="position: relative">
<ul class="linksColl">
<li><a href="#"><img onmouseover="move()" src="images/links/communicate.png" alt="" width="175" height="78" border="0" /></a></li>
<li><a href="#"><img onmouseover="move()" src="images/links/library.png" alt="" width="125" height="79" border="0" /></a></li>
<li><a href="#"><img onmouseover="move()" src="images/links/memory.png" alt="" width="176" height="78" border="0" /></a></li>
<li><a href="#"><img onmouseover="move()" src="images/links/discussions.png" alt="" width="137" height="78" border="0" /></a></li>
<li><a href="#"><img onmouseover="move()" src="images/links/about.png" alt="" width="126" height="78" border="0" /></a></li>
<li><a href="index.php"><img onmouseover="move()" src="images/links/articles.png" alt="" width="125" height="78" border="0" /></a></li>
</ul>
<div class="linkHover"></div>
</div>
我想改變姿勢的DIV類linkHover當鼠標放在標題鏈接,但它不工作。
如何讓linkHover DIV在linkColl DIV上跟隨鼠標光標?
注:我想跟進只是水平不垂直
您需要以確保'linkhover'也是'absolute'或'relative',對於'right'參數來說工作。 – 2011-03-23 11:04:57