2012-01-18 92 views
2

开发一个菜单,我遇到了一些相当简单的问题(显然不适合我)。更改另一个div的背景悬停多个按钮

EXPLANATION IMAGE http://img80.imageshack.us/img80/7060/hoverdivexpl.jpg

背景/菜单按钮,是所有图像。

我已经试图解决与其他StackOverflow(和其他)用户的建议,但无法弄清楚如何进行。一旦它徘徊按钮,但不切换回div的bg;然后工作,但没有任何消失。

对Web开发/ jQuery有基础知识,我卡住了。

+0

请使用您的代码创建一个http://jsfiddle.net/演示。 – 2012-01-18 10:39:39

+0

你目前的代码不能切换回来吗? – musefan 2012-01-18 10:39:42

+0

菲利克斯,我想读一些代码 – 2012-01-18 10:40:09

回答

0

对于这两个按钮像

$(selector1).hover(
    // Function to call when mouse enters element 
    function() { 
     // Animate to set new background in 100 milliseconds 
     $(this).animate({'background': 'A'},100); 
     $(bigdivselector).animate({'background': 'A'},100); 
    }, 
    // Function to call when mouse leaves element 
    function() { 
     $(this).animate({'background': 'defaultBG'},100); 
     $(bigdivselector).animate({'background': 'defaultBG'},100); 
    }, 
); 

很明显,您必须用正确的值来替代选择和背景。

相关问题