<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript'>
$(document).ready(function(){
$("img.a").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
$(this).stop().animate({"opacity": "1"}, "slow");
});
});
</script>
<style>
div.fadehover {
position: relative;
}
img.a {
position: absolute;
z-index: 10;
}
img.b {
position: absolute;
}
</style>
</head>
<body>
<div class="fadehover" align="center">
<img src="Facebook.png" alt="" class="a" />
<img src="Facebook_hover.png" alt="" class="b" />
</body>
所以我有這個圖像淡入淡出效果在我的形象,它工作正常。但我試圖將它放在我想要的位置,因爲現在它位於左上角。我怎樣才能將圖像定位在中心?或者一般我想要的地方?嘗試簡單的中心標籤,但沒有奏效。有任何想法嗎?如何定位具有jquery懸停效果的圖像?
使用CSS來定位。 –