tags:

views:

13

answers:

1

Is it possible to change CSS position of a background image with a DIV ("omega") from a separate link ("alpha") with a MOUSEOVER?

<a class="omega" href="#"></a>

<div id="alpha"></div>
A: 

Is JavaScript/jQuery ok? If so, something like this should work:

$('.omega').hover(function(){
    $('#alpha').css('backgroundPosition', '500px 150px');
}, function(){
    $('#alpha').css('backgroundPosition', '0px 0px');
});

The first function is for mouseover, the second one resets it when the mouse leaves. Admittedly, I haven't tried this, but in theory it should work. See jquery hover and jquery css for more info.

mlms13