home - Copy.js
// adding an event listener to the document which fires once the DOM is loaded and then triggers the startup function
adding an event listener to the document which fires once the DOM is loaded and then triggers the startup function
adding an event listener to the document which fires once the DOM is loaded and then triggers the startup function
function startup() {
  for(var i = 0; i < 4; i++) {    
    var el = document.getElementById("image"+i);
    el.addEventListener("touchstart", handleStart, false);
    el.addEventListener("touchend", handleEnd, false);
    el.addEventListener("touchcancel", handleCancel, false);
    el.addEventListener("touchmove", handleMove, false);
    }
  for(var i = 0; i < 4; i++) {    
    var el = document.getElementById("image"+i);
    el.addEventListener("mousedown", handleMouseDown);
    el.addEventListener("mouseup", handleMouseUp);
    }
}
function startup ( ) { for ( var i = 0 ; i < 4 ; i ++ ) { var el = document . getElementById ( "image" + i ) ; el . addEventListener ( "touchstart" , handleStart , false ) ; el . addEventListener ( "touchend" , handleEnd , false ) ; el . addEventListener ( "touchcancel" , handleCancel , false ) ; el . addEventListener ( "touchmove" , handleMove , false ) ; } for ( var i = 0 ; i < 4 ; i ++ ) { var el = document . getElementById ( "image" + i ) ; el . addEventListener ( "mousedown" , handleMouseDown ) ; el . addEventListener ( "mouseup" , handleMouseUp ) ; } }
adding an event listener to the document which fires once the DOM is loaded and then triggers the startup function
adding an event listener to the document which fires once the DOM is loaded and then triggers the startup function
// loop through the divs containing images and add event listeners // loop through the divs containing images and add event listeners