I'm having several problems converting this snippet of code with jQuery using only Typescript.
function addTourOverlay() {
if ($('#tour-overlay').length === 0) {
$('body').prepend('<div id="tour-overlay"></div>');
}
resizeOverlay();
}
function resizeOverlay() {
var window_height = $(window).height;
var window_width = $(window).width;
$('#tour-overlay').height(window_height).width(window_width);
}
Currently the conversion looks like this:
addTourOverlay2() {
if (document.querySelectorAll('#tour-overlay').length === 0) {
let newDiv = document.createElement('div');
newDiv.id = 'tour-overlay';
let body = document.getElementsByTagName('body');
newDiv.appendChild(body);
}
this.resizeOverlay();
}
resizeOverlay() {
let window_height = screen.height;
let window_width = screen.width;
document.getElementById('#tour-overlay').style.height = window_height;
document.getElementById('#tour-overlay').style.width = window_width;
}
I'm getting the following errors: Type 'number' can not be assigned to type 'string'. (lines 36 and 37)
The argument of type 'NodeListOf' is not attributable to the parameter of type 'Node'. The 'baseURI' property is missing in type 'NodeListOf'. (Line 28)