Jquery 更改另一个div';鼠标悬停在多个按钮上的背景
在开发菜单时,我遇到了一些相当简单的问题(显然对我来说不是) 背景/菜单按钮都是图像 我已经尝试用其他StackOverflow(和其他)用户的建议来解决这个问题,但不知道如何继续。一旦它工作,悬停按钮,但不切换回div的背景;然后工作,但没有褪色Jquery 更改另一个div';鼠标悬停在多个按钮上的背景,jquery,animation,Jquery,Animation,在开发菜单时,我遇到了一些相当简单的问题(显然对我来说不是) 背景/菜单按钮都是图像 我已经尝试用其他StackOverflow(和其他)用户的建议来解决这个问题,但不知道如何继续。一旦它工作,悬停按钮,但不切换回div的背景;然后工作,但没有褪色 我对web开发/jQuery有了基本的了解,我被卡住了。对于这两个按钮 $(selector1).hover( // Function to call when mouse enters element function() {
我对web开发/jQuery有了基本的了解,我被卡住了。对于这两个按钮
$(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);
},
);
显然,您必须用适当的值替换选择器和背景。这两个按钮类似
$(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);
},
);
显然,您必须用正确的值替换选择器和背景。请用您拥有的代码创建一个演示。您当前的代码中有哪些没有切换回?Felix,我想读一些代码。添加一段示例代码可能是一个好主意。如果您将它添加到jsfiddle.net中会更好。这样,回答的人就可以确切地看到你尝试了什么,从而知道你做错了什么。现在它看起来更像是一个“给我代码plx,我太懒了”的问题。@Umesh:别告诉我,告诉Manuel;)请用你拥有的代码创建一个演示。你当前的代码中有哪些没有切换回?Felix,我想读一些代码。添加一段示例代码可能是个好主意。如果您将它添加到jsfiddle.net中会更好。这样,回答的人就可以确切地看到你尝试了什么,从而知道你做错了什么。现在它看起来更像是一个“给我代码plx,我太懒了”的问题。@Umesh:别告诉我,告诉Manuel;)