I set the following CSS at the top of my file:
#img1, #img2, #img3 {
  background: url("bates-sprite.jpeg");
  background-repeat: no-repeat;
  object-fit: none;
}
#img1 {object-position: 0 0;
  width:  816px; // full size 3264
  height: 612px; // full size 2448
}
This is the relevant part of my JavaScript:
    var tempDiv = document.createElement('div');
    tempDiv.setAttribute("id", "bigImg" + figNum);
    // Make tempDiv High enough to hold the scaled up image.
    // This line is causing a problem
    let imgHeight = document.getElementById("img1").clientHeight;
   // let imgHeight = "1224px";
   tempDiv.style.height = parseInt(imgHeight) + parseInt("400px") + "px";
If I set imgHeight explicitly to 1224 pixels, the function works perfectly. If instead I use clientHeight, it fails. How can I fix it?
 
     
    