function initialize(masterID) {
   const img = document.getElementById(masterID + 'Image');
   let imgPosition = img.getBoundingClientRect();
   img.style.height = Math.round(imgPosition.height) + 'px';
   img.style.width = Math.round(imgPosition.width) + 'px';
   imgPosition = img.getBoundingClientRect();

   initLens();
   initZoom();

   // Start position and size of the zoom
   function initZoom() {
      const zoom = document.getElementById(masterID + 'Zoom');

      zoom.style.backgroundImage = "url('" + img.src + "')";
      zoom.style.left = 0 + 'px';
      zoom.style.top = 0 + 'px';
      zoom.style.height = Math.round(imgPosition.height/10) + 'px';
      zoom.style.width = Math.round(imgPosition.width/10) + 'px';
   }

   // Start position and size of the lens
   function initLens() {
      const lens = document.getElementById(masterID + 'Lens');

      lens.style.left = 0 + 'px';
      lens.style.top = 0 + 'px';
      lens.style.height = Math.round(imgPosition.height/10) + 'px';
      lens.style.width = Math.round(imgPosition.width/10) + 'px';
   }
}
/**
 * This function initialise the elements so they can work
 *
 * @param masterID -- The ID of the main element
 */
This function initialise the elements so they can work
@param masterID -- The ID of the main element
This function initialise the elements so they can work @param masterID -- The ID of the main element
function initialize(masterID) {
   const img = document.getElementById(masterID + 'Image');
   let imgPosition = img.getBoundingClientRect();
   img.style.height = Math.round(imgPosition.height) + 'px';
   img.style.width = Math.round(imgPosition.width) + 'px';
   imgPosition = img.getBoundingClientRect();
   initLens();
   initZoom();
   function initZoom() {
      const zoom = document.getElementById(masterID + 'Zoom');
      zoom.style.backgroundImage = "url('" + img.src + "')";
      zoom.style.left = 0 + 'px';
      zoom.style.top = 0 + 'px';
      zoom.style.height = Math.round(imgPosition.height/10) + 'px';
      zoom.style.width = Math.round(imgPosition.width/10) + 'px';
   }
   function initLens() {
      const lens = document.getElementById(masterID + 'Lens');
      lens.style.left = 0 + 'px';
      lens.style.top = 0 + 'px';
      lens.style.height = Math.round(imgPosition.height/10) + 'px';
      lens.style.width = Math.round(imgPosition.width/10) + 'px';
   }
}
function initialize ( masterID ) { const img = document . getElementById ( masterID + 'Image' ) ; let imgPosition = img . getBoundingClientRect ( ) ; img . style . height = Math . round ( imgPosition . height ) + 'px' ; img . style . width = Math . round ( imgPosition . width ) + 'px' ; imgPosition = img . getBoundingClientRect ( ) ; initLens ( ) ; initZoom ( ) ; function initZoom ( ) { const zoom = document . getElementById ( masterID + 'Zoom' ) ; zoom . style . backgroundImage = "url('" + img . src + "')" ; zoom . style . left = 0 + 'px' ; zoom . style . top = 0 + 'px' ; zoom . style . height = Math . round ( imgPosition . height / 10 ) + 'px' ; zoom . style . width = Math . round ( imgPosition . width / 10 ) + 'px' ; } function initLens ( ) { const lens = document . getElementById ( masterID + 'Lens' ) ; lens . style . left = 0 + 'px' ; lens . style . top = 0 + 'px' ; lens . style . height = Math . round ( imgPosition . height / 10 ) + 'px' ; lens . style . width = Math . round ( imgPosition . width / 10 ) + 'px' ; } }
This function initialise the elements so they can work
 @param masterID -- The ID of the main element
This function initialise the elements so they can work @param masterID -- The ID of the main element
// Start position and size of the zoom // Start position and size of the lens