<!DOCTYPE html>
<html>
<head>
<script data-require="jquery@*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h1>Scroll multiple DIV...</h1>
<div class="container-top">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="container-top">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="container-top">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="container-left">
<div class="sub-container">
Lorem ipsum dolor sit amet
</div>
</div>
<div class="container-left">
<div class="sub-container">
Lorem ipsum dolor sit amet
</div>
</div>
<div class="container-left">
<div class="sub-container">
Lorem ipsum dolor sit amet
</div>
</div>
</body>
</html>
// Code goes here
$(document).ready(function(){
var containerTop = $('.container-top');
containerTop.scroll(function(){
containerTop.scrollTop($(this).scrollTop());
});
var containerLeft = $('.container-left');
containerLeft.scroll(function(){
containerLeft.scrollLeft($(this).scrollLeft());
});
});
/* Styles go here */
.container-top{
max-width:150px;
max-height:150px;
overflow-y:scroll;
}
.container-left{
width:100%;
overflow:scroll;
}
.sub-container{
width:1000%;
}
div{
margin-bottom:25px;
}