portfolio/src/main/webapp/script.js
// disables or enables navigation buttons based on the currently displayed image
disables or enables navigation buttons based on the currently displayed image
disables or enables navigation buttons based on the currently displayed image
function updateButtonsState(visibleImgId) {
  const prevButton = document.getElementById('btn-prev');
  const nextButton = document.getElementById('btn-next');
  if (visibleImgId === 1) {
    prevButton.disabled = true;
  } else if (prevButton.disabled) {
    prevButton.disabled = false;
  }
  if (visibleImgId === totalImages) {
    nextButton.disabled = true;
  } else if (nextButton.disabled) {
    nextButton.disabled = false;
  }
}
function updateButtonsState ( visibleImgId ) { const prevButton = document . getElementById ( 'btn-prev' ) ; const nextButton = document . getElementById ( 'btn-next' ) ; if ( visibleImgId === 1 ) { prevButton . disabled = true ; } else if ( prevButton . disabled ) { prevButton . disabled = false ; } if ( visibleImgId === totalImages ) { nextButton . disabled = true ; } else if ( nextButton . disabled ) { nextButton . disabled = false ; } }
disables or enables navigation buttons based on the currently displayed image
disables or enables navigation buttons based on the currently displayed image
// disable "Prev" button if there are no images left before current // if there are a few images before and "prev" is disabled, enable it // disable "Next" button if the last image is currently displayed // if there are a few images after and "next" is disabled, enable it