我有以下 JavaScript 代码用于使用 JQuery 的简单悬停:
$('.product_img_link').hover(function(){
$(this).prev('.hoverProduct').show();
},function(){
$(this).prev('.hoverProduct').hide();
});
div(使用 class找到前一个hoverProduct,并在悬停时显示它并在鼠标移出时隐藏它)。
如何在没有 JQuery 的情况下仅使用纯 JavaScript 编写此代码段?