Here is the code snippet I have been working on:
...<script>
function adjustElementSize()
{
var newSize = window.innerWidth - 600;
document.getElementById("spin").style.width = newSize + "px";
document.getElementById("spin").style.height = newSize + "px";
}
</script>
</head>
<body>
<section id="spin" onLoad="adjustElementSize()">...
I am attempting to create a function that dynamically sets the height and width of an element based on the window size using a specific formula. However, despite my best efforts and following various examples, I am struggling to make this code work. As a newcomer to JavaScript with limited knowledge, I am seeking assistance to identify any mistakes in my approach. Any guidance would be greatly appreciated!