Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

scroll two divs simultaneously site:stackoverflow.com

// https://stackoverflow.com/questions/9236314/how-do-i-synchronize-the-scroll-position-of-two-divs/9236351

var isSyncingLeftScroll = false;
var isSyncingRightScroll = false;
var leftDiv = document.getElementById('left');
var rightDiv = document.getElementById('right');

leftDiv.onscroll = function() {
  if (!isSyncingLeftScroll) {
    isSyncingRightScroll = true;
    rightDiv.scrollTop = this.scrollTop;
  }
  isSyncingLeftScroll = false;
}

rightDiv.onscroll = function() {
  if (!isSyncingRightScroll) {
    isSyncingLeftScroll = true;
    leftDiv.scrollTop = this.scrollTop;
  }
  isSyncingRightScroll = false;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: UPA Error 
Csharp :: call a .NET assembly from C or c++ 
Csharp :: c# ClassMap 
Csharp :: add two large numbers 
Csharp :: difference between %e/E, %f/F and %g/G in program C 
Csharp :: move dotnet dlls to another folder 
Csharp :: ef core save keyless entity 
Csharp :: how to move an object with addforce 
Csharp :: push vaiable in array c# 
Csharp :: c# variables 
Csharp :: c# code for simplex method 
Csharp :: wpf onpropertychanged not working 
Csharp :: c# dictionary key set 
Csharp :: c# blazor update state 
Csharp :: ASP.MVC display image from SqlServer 
Csharp :: calculated field gridview asp.net 
Csharp :: ASP.NET Web Forms TextBox 
Csharp :: c# open explorer and select file 
Csharp :: c# capitalize first letter of each word 
Csharp :: How to do a comment in c# 
Csharp :: shutdownHook c# 
Csharp :: mock return exception c# 
Csharp :: generate an mvc controller when dotnet core command line 
Csharp :: c# return error status code based on exception 
Csharp :: asp.net Read raw Body 
Csharp :: unity matchinfo 
Csharp :: input string was not in a correct format convert to double 
Csharp :: An unhandled exception occurred during the execution of the current web request 
Csharp :: System.InvalidOperationException: No owin.Environment item was found in the context. 
Csharp :: getcomponent 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =