Open Xierip opened 9 years ago
You can do it like this
if ($('#terminal span').length>0 && $('#terminal span')[0].children.length==0 ) {
var boy = $('#terminal span')[0];
var perW = boy.offsetWidth / boy.textContent.length;
var col = Math.floor($('#terminal')[0].offsetWidth / perW);
term.resize(30, col);
}
any question @ me
Is there a way to do this without jQuery?
It would be really nice if term.js automatically calculated the row/col if no parameters were given for .resize() to fit the size of the container element.
Like. .
term.resize();
If you have not figured this out already, you can do this without jQuery. Just use native JS to select the elements, the rest is the same. ie. document.getElementById("terminal");
Then submit a PR with new resize() API ;)
Hi, how i can create dynamic console (auto scale) my css is in 100% automatic, check it http://scr.hu/6gnm/hf54f && http://scr.hu/6gnm/cmryo
code:
var doc = document.getElementById('panel-body'); var term = new Terminal({ cols: (doc.clientWidth/6.36), rows: 40, useStyle: true, });