0

Currently, I have a block with a scrollable div tag inside it on the left side: https://paste.pics/2b27787ffd9e5671df4d34b0b656ba2a

I want to scroll the div tag on the left side of the attached image when the mouse hovers on the right side of the attached image (brown background), how can this be done?

Pawel Veselov
  • 3,996
  • 7
  • 44
  • 62

2 Answers2

0

div {
    width: 300px;
    height: 200px;
    overflow-y: scroll
}
<div></div>

without js you can able to scroll with fix height of div and css overflow property

General Grievance
  • 4,555
  • 31
  • 31
  • 45
sabir sam
  • 83
  • 1
  • 6
0

check Find mouse position relative to element to catch cursor position on your right panel

using right panel size you'll easily compute position in % if need

compute the visible box of your left panel from cursor center position and change properties scrollTop and scrollLeft of your left panel accordingly

https://developer.mozilla.org/fr/docs/Web/API/Element/scrollTop

r043v
  • 1,859
  • 1
  • 15
  • 25