I am wondering if there is a way to shorten the code below. I have shown the first 5 if statements. I will have a total of 10 when I am done.
EDIT: FORGOT THE MOUSEMOVE PART
$("#bar").mousemove(function(e){
var vb = $(this);
if(e.pageX <=467 && e.pageX > 457){
vb.attr("src","images2/vb10.png");
vol =10;
}
if(e.pageX <=457 && e.pageX > 447){
vb.attr("src","images2/vb9.png");
vol=9;
}
if(e.pageX <=447 && e.pageX > 437){
vb.attr("src","images2/vb8.png");
vol=8;
}
if(e.pageX <=437 && e.pageX > 427){
vb.attr("src","images2/vb7.png");
vol=7;
}
if(e.pageX <=427 && e.pageX > 417){
vb.attr("src","images2/vb6.png");
vol=6
}
});
Thanks!
else if.