使用 jQuery 将鼠标悬停转换为滚动
Converting mouseover to on scroll with jQuery
我有一块 jQuery 当我的光标悬停在 div 上时它可以工作,但是我想更改它以便触发 "on scroll"。有什么建议吗??
$('.services-item').mouseover(function(){
$('.services-item').off('mouseover', servicesHoverAction).on('mouseover', servicesHoverAction);
//servicesHoverAction();
});
您应该将代码更改为:
$('.services-item').scroll(() => {
$('.services-item').off('mouseover', servicesHoverAction).on('mouseover', servicesHoverAction);
//servicesHoverAction();
});
我有一块 jQuery 当我的光标悬停在 div 上时它可以工作,但是我想更改它以便触发 "on scroll"。有什么建议吗??
$('.services-item').mouseover(function(){
$('.services-item').off('mouseover', servicesHoverAction).on('mouseover', servicesHoverAction);
//servicesHoverAction();
});
您应该将代码更改为:
$('.services-item').scroll(() => {
$('.services-item').off('mouseover', servicesHoverAction).on('mouseover', servicesHoverAction);
//servicesHoverAction();
});