Question

I have two textarea with approx. the same information how to make that if user scroll one than automatically another is scrolled. (textareas of same width) I am thinking of onscroll event, but how to measure height?

P.S. I am using tinyMCE, if this info can help or change answer/approach.

Was it helpful?

Solution

Here is a start on how to do that, check my fiddle: http://jsfiddle.net/shahe_masoyan/2enVx/3/

$('#firstTextArea').on("scroll" , function (){
    var sctop = $(this).scrollTop();
    $('#secondTextArea').scrollTop(sctop);
});

OTHER TIPS

you can do so using the scroll function

$(document.getElementById("txt1")).scroll(function(){
   $(document.getElementById("txt2")).scrollTop($(this).scrollTop());
})

http://jsfiddle.net/GXaGD/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top