您不能使用 jQuery 设置悬停样式。我建议在你的 CSS 中创建一个悬停类并使用 addClass 应用它:
CSS:
.portfolio-item-holder:hover,
.portfolio-item-holder.hover {
// these styles will be applied when naturally hovered
// and when elements with the class "portfolio-item-holder"
// also have the class "hover"
}
Javascript:
$('.portfolio-item-hover-content').on('mouseenter', function(){
$('.portfolio-item-holder').addClass('hover')
});
你可以在 mouseleave 上删除它:
$('.portfolio-item-hover-content').on('mouseleave', function(){
$('.portfolio-item-holder').removeClass('hover')
});