Reducing code - array?
Reducing code - array?
Hi,
Maybe you can help me to reduce the code of a simple hover func.
I have a link on a graphical bar. When I hover over it, it should change
the background of the bar. As I have 7 different categories, the code
is getting long. So, perhaps there is a chance to shrink it a little bit:
-
$("a.message_overview").hover(
function() {
$('div.overview').css({backgroundPosition: '0 -88px'});
},
function () {
$('div.overview').css({backgroundPosition:"0 0"});
});
$("a.message_letter").hover(
function() {
$('div.letter').css({backgroundPosition: '0 -88px'});
},
function () {
$('div.letter').css({backgroundPosition:"0 0"});
});
$("a.message_event").hover(
function() {
$('div.event').css({backgroundPosition: '0 -88px'});
},
function () {
$('div.event').css({backgroundPosition:"0 0"});
});
thanks
TC