diff --git a/src/tabcomplete.js b/src/tabcomplete.js index b3f414f..7978185 100644 --- a/src/tabcomplete.js +++ b/src/tabcomplete.js @@ -197,6 +197,17 @@ ); } + + // Propagate scroll events from element to element . + function follow_scroll(source, destination) { + source.bind("input keydown keyup focus blur click change scroll", function() { + setTimeout(function() { + destination.scrollTop(source.scrollTop()); + destination.scrollLeft(source.scrollLeft()); + }, 0); + }); + } + // Show placeholder text. // This works by creating a copy of the input and placing it behind // the real input. @@ -226,6 +237,7 @@ clone.css({ position: "absolute", }); + follow_scroll(input, clone); } var hint = "";