简体   繁体   English

当两个div在移动设备中一个相对另一个放置时,如何使用CSS滚动悬停的div?

[英]How to scroll the hovered div using CSS when two divs are placed one over the other in mobile?

I have a situation where there are two divs 我的情况是有两个div
Yellow div and Red div as shown in the below figure 黄色div和红色div如下图所示

在此处输入图片说明

Case 1: 情况1:
User scrolls on Yellow div, only the contents of yellow are scrolled. 用户在Yellow div上滚动,仅滚动yellow的内容。 (Works as expected) (按预期工作)

Case 2: 情况2:
User scrolls on Red div, only the contents of red are scrolled. 用户在Red div上滚动,仅滚动red的内容。 (Works as expected) (按预期工作)

Case 3: 情况3:
When the scroll on Red div is complete, then on further scrolling the contents of Yellow div start scrolling. 当Red div上的滚动完成时,然后进一步滚动Yellow div的内容就开始滚动。

I need to actually lock the scroll of yellow div when the user's touch is on red. 当用户的触摸为红色时,我实际上需要锁定黄色div的滚动。
Any suggestions? 有什么建议么?

Capture the on hover event of red div and lock the scroll of yellow div 捕获红色div的悬停事件并锁定黄色div的滚动

$("#redDiv").hover(function(){
     $("#yellowDiv").css("overflow-y","hidden");
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM