开发者

Animating a containing <div> using jQuery .animate doesn't work in IE

I'm trying to animate a div (htmLayer1), which contains two other divs (htmLayer1tab and htmLayer1pic) using jQuery .animate.

The following code works fine in Firefox, Safari, Chrome and Opera:

$("#htmLayer1tab").toggle(
            function() {
                $("#htmLayer1").animate({top: "-435px"}, 300, "swing");
            },
            function() {
                $("#htmLayer1").animate({top: "0px"}, 300, "swing");
                $("#htmLayer1tab").css("z-index", 7);
            }
);

, but in IE the only thing that moves is the tab-div. The picture-div doesn't follow.

The picture is added to htmLayer1pic through CSS as a background-image and the tab is achieved through an img-tag inside 开发者_如何学JAVAhtmLayer1tab.

Why won't IE animate both divs inside htmLayer1, but only one of them? And what can I do to fix it?

Kind regards,

bingocaller

EDIT:

I've created a more detailed fiddle here: jsFiddle Example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜