简体   繁体   中英

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
Yellow div and Red div as shown in the below figure

在此处输入图片说明

Case 1:
User scrolls on Yellow div, only the contents of yellow are scrolled. (Works as expected)

Case 2:
User scrolls on Red div, only the contents of red are scrolled. (Works as expected)

Case 3:
When the scroll on Red div is complete, then on further scrolling the contents of Yellow div start scrolling.

I need to actually lock the scroll of yellow div when the user's touch is on red.
Any suggestions?

Capture the on hover event of red div and lock the scroll of yellow div

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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