This is probably a silly question – I’m using term.js to simulate a linux terminal.
Everything works fine. The only issue I am having is – the page where I have embedded it is pretty long and this terminal is somewhere at the bottom – but as soon as the page loads – it automatically scrolls down to the bottom of the page with the terminal.
I’ve been going through the term.js code commenting and trying different things to remove focus – but nothing seems to work.
Advertisement
Answer
term.open()
does a focus for the terminal at the end of the function. Simply comment it out and it won’t scroll down to the terminal.
At line 801:
setTimeout(function() { self.element.focus(); }, 100);
I made a JSFiddle to demonstrate it.
As an alternative to modifying the code you could
- put the terminal into an iframe.
- load the terminal dynamically on a user event (button click).