此代码的作用是,当您将鼠标悬停在列表中的某个项目上时,它会变为红色,并在下方显示另一个列表。如果您不再将鼠标悬停在任何元素上,则目标是让您悬停的最新事物在其被清除之前停留 3 秒。
$('#stockList li').hover(
function () {
$(this).css({ color: 'red' }); //mouseover
if ($(this).text() == symbol) {
$('#stockInfo').append('<div><ol><li>' + "Company = " + company + '</li><br/><li>' + "Market = " + market + '</li><br/><li>' + "Sector = " + sector + '</li><br/><li>' + "Price = " + price + '</li><br/><li>' + "Year Range = " + low + " " + high + '</li><br/><li>' + "Dividend = " + amount + " " + yieldx + " " + frequency + '</li></ol><br/></div>');
}
},
function () {
$(this).css({ color: 'navy' }); // mouseout
$('#stockInfo').empty();
}
);