I've modified the code slightly to get it to work without having the rest. Hopefully you'll be able to get everything to work correctly from this:
var op =0.1;
var op1 = 10;
var step = .1; //changed to .1 from 10
var min = 0.1, max = 1;
var min1 = 10, max1 = 100;
var image = document.getElementById("image");
image.style.opacity = op;
//image.style.filter = alpha(opacity=op1); //removed (implement browser check if IE)
$(document).on('keydown', function(e) {
if(e.keyCode === 37) { //made === (preference)
op-=step;
op1-=step;
op = Math.max(min, op);
op1 = Math.max(min, op1);
image.style.opacity = Math.min(max, op); //added
} else if(e.keyCode === 39) {//made === (preference)
op+=step;
op1+=step;
image.style.opacity = Math.min(max, op);
op1 = Math.min(max, op1);
}
});
Note: You'll need to click into the results
box (bottom right) in the example above before hitting the left/right arrow keys.