我有一堆包含在链接中的图像,例如:
<a class="tipsFeatured" href="#" rel="products/p0.html"><img src="assets/img/products-shoppingview-and-registryview/horne/resized/pott-5pc-setting-pott.jpg" alt="Silver Cutlery" width="170" height="170" /></a>
<a class="tipsFeatured" href="#" rel="products/p1.html"><img src="assets/img/products-shoppingview-and-registryview/horne/resized/Design-House-Stockholm-Cobalt_Pitcher.jpg" alt="Design House Stockholm Cobalt Pitcher" width="170" height="170" /></a>
我有一个 id 为 #descText 的 div,我希望当鼠标悬停在每个链接上时,div 会出现在当前元素旁边,每次都有不同的文本。“每次不同的文本”部分我知道该怎么做,但我无法让 div 出现在我刚刚拥有的当前悬停元素旁边:
$('.tipsFeatured').bind('mouseover',function(){
var $txt = $('#descText');
$(this).next().append($txt.css('display','block'));
});