portfolio/src/main/webapp/script.js
// hides currently displayed image and displays the one with the passed id
hides currently displayed image and displays the one with the passed id
hides currently displayed image and displays the one with the passed id
function updateDisplayedImage(imageId) {
  const visibleImg = document.getElementsByClassName('visible')[0]; 
  const nextVisibleImg = document.getElementById(imageId);
  if (nextVisibleImg) {
    visibleImg.classList.remove('visible');
    nextVisibleImg.classList.add('visible');
    updateButtonsState(Number(nextVisibleImg.id));
  } else {
    alert('Error! Can\'t find the requested image');
  }
}
function updateDisplayedImage ( imageId ) { const visibleImg = document . getElementsByClassName ( 'visible' ) [ 0 ] ; const nextVisibleImg = document . getElementById ( imageId ) ; if ( nextVisibleImg ) { visibleImg . classList . remove ( 'visible' ) ; nextVisibleImg . classList . add ( 'visible' ) ; updateButtonsState ( Number ( nextVisibleImg . id ) ) ; } else { alert ( 'Error! Can\'t find the requested image' ) ; } }
hides currently displayed image and displays the one with the passed id
hides currently displayed image and displays the one with the passed id
// get currently displayed image // if next image is present on the page, remove class 'visible' from the current image and add it to the next // update buttons' states - enabled/disabled