【发布时间】:2009-04-20 17:14:16
【问题描述】:
$(document).ready(function () {
// Hide all large images except the first one
$('#imageContainer img').hide().filter(':first').show();
// Select all thumb links
$('#thumbContainer a').hover(function (event) {
// Hide all large images except for the one with the same hash as our thumb link
$('#imageContainer img').hide().filter(this.hash).show();
},
function () { } // Because the hover method has a mouseout state we need to define too
);
});
此 .js 脚本适用于将鼠标悬停在锚标记上。但是,我希望这个函数可以在整个 div 上工作。
如何更改这部分:.filter(this.hash).show();
对此:.filter(this.(id or unique name).show();
【问题讨论】: