Arrow to move to the right of the page does not stop at the end

1

Good afternoon,

I need a help because I built a horizontal page that besides the scroll of the mouse it also uses the arrows on the side for the movement, but the more you press the arrows, the more it advances regardless if you have reached the bottom of the page or not , I sent the code I used, could you give me some help:

var projObj = null;

function init(){
   projObj = document.getElementById('PagProjetos');
   projObj.style.position= 'relative'; 
   projObj.style.right = '0px';
}

function moveRight(){
   projObj.style.right = parseInt(projObj.style.right) + 600 + 'px';

}
function stop(){
   projObj.style.right = '0px'; 
}

window.onload =init;

Thank you very much

    
asked by anonymous 24.05.2016 / 18:49

1 answer

0

I did some research and got to the code below, but it still did not work, could anyone give a help?

<script>

function init(){
   projObj = document.getElementById('PagProjetos');
   projObj.style.position= 'relative'; 
   projObj.style.right = '0px';

  totalDeImagens = document.getElementeByName('nomeDasImagens');
}

function moveRight(){

  if(contadorDeImages< totalDeImagens){
    projObj.style.right = parseInt(projObj.style.right) + 600 + 'px';
    contadorDeImages++;
  }else{
    projObj.style.right = '0px';
    contadorDeImages = 0;
  }
}
function stop(){
   projObj.style.right = '0px'; 
}

window.onload =init;

// - >

    
25.05.2016 / 16:00