我有一些代码非常适合我的悬停状态。但是,如果链接已经处于活动状态,即当我将鼠标悬停在它上面时,ArrowHover 已经附加到 div 上,显然它会由于 jquery 中的切换类而删除 ArrowHover。我如何确保在已经激活的链接上不会发生这种情况?
$("#JobApplications").hover(function()
{
$("#JobApplicationsArrow.Arrow").toggleClass('ArrowHover')
}
)
It would be helpful if we could see your HTML object, to know if it is an anchor tag or not... but assuming it is an anchor tag, try something along with this concept:
if ( $("#JobApplicationsArrow.Arrow").href != window.location.href ) {
$("#JobApplicationsArrow.Arrow").toggleClass('ArrowHover')
}
It is a modified version from this post:
使用 css 技术而不是 jQuery 修复它。无论如何,干杯亚当!