-1

为变量赋值时,变量取了错误的值。代码是

var txtColor = $(".menu-item").css("background-color");

其中$(".menu-item").css("background-color");代表粉红色。而是txtColor作为"transparent"

我只在 IE-8 中看到这个问题。

谁能帮我解决这个问题。

提前致谢。

4

1 回答 1

0

Question, is your CSS set up like this?

background: pink;

If so, try using $('.menu-item').css("background"); instead.

Old versions of IE will not properly cascade group definitions (like background) to the other settings. In modern browsers, defining background as "pink" will also set the background-color to "pink".

于 2015-04-16T05:38:28.317 回答