我在想你能不能给我一个更好的方法, 实现我在这个小提琴上产生的效果: http://jsfiddle.net/YLuKh/1/
基本上,我想将锚标记的背景颜色动画,以显示一个图像,我通过在图像上方的宽度上方放置一个锚标记,然后在盘旋动画上显示宽度。 任何人都可以建议更直截了当的方式做到这一点吗?
HTML HTML
<ul id="test">
<li>
<a href="">This is the link</a>
<span class="bg"></span>
<img src="http://www.ritaxxii.org/wp-content/uploads/Luxury-Bedroom-Furniture-1.jpg" />
</li>
</ul>
联署联合材料联合材料
$(document).ready(function() {
var li_width = $( #test ).find( li ).width();
console.log(li_width);
$( #test ).find( li ).on( mouseover , function() {
$(this).find( .bg ).stop().animate({
width: 0
}, 200);
}).on( mouseout , function() {
$(this).find( .bg ).stop().animate({
width: li_width
}, 200);
});
});