J O'Driscoll
J O'Driscoll

Reputation: 315

On hover, change another element CSS

Have a fairly simple question for a jQuery developer out there. I'm attempting to change a CSS attribute for an element when I hover over a different element in the page.

I've put together a fiddle for review, I'm just wondering which part I screwed up.

jsfiddle

$('a[href*='our_work']').hover(function(){
    $('div[id*="HM_Menu562"]').css({ top: '50' });
}, function(){
    $('div[id*="HM_Menu562"]').css({ top: '105' });
});

Please be aware, I'm working with my clients code and I'm very limited to modifying what currently exists.

Upvotes: 0

Views: 455

Answers (1)

nnnnnn
nnnnnn

Reputation: 150080

You have a syntax error in that you didn't properly nest or escape your quotes:

$('a[href*='our_work']').hover(function(){

Should be:

$('a[href*="our_work"]').hover(function(){

Demo: http://jsfiddle.net/cTeV5/19/

Upvotes: 2

Related Questions