我做了一点不同的设置:
http://jsfiddle.net/Sjnv8/38/
#parent {
width: 100%;
background-color: gray;
height: 100%;
position: relative;
overflow: hidden;
padding: 0;
margin: 0;
}
#panel1 {
background-color: yellow;
width: 100%;
padding: 0;
margin: 0;
position:absolute;
z-index:1;
}
#panel2 {
background-color: orange;
position:absolute;
z-index:2;
width: 100%;
left: 33.34%;
padding: 0;
margin: 0;
}
#panel3 {
background-color: green;
width: 100%;
left: 66.66%;
padding: 0;
margin: 0;
z-index:3;
}
#panel3img {
/*border-left: 1px solid #333333;
width: auto;
position: relative;
left: -35%;*/
}
.hov {
/****keeps wide divs from flowing down to next line****/
position: absolute;
/****hides overflowing content****/
overflow: hidden;
}
/*.abs {
position: relative;
top: 0;
}*/
所有元素的宽度都设置为 width:100%,它们有 position:absolute,而不是动画宽度,只是动画位置。出于某种原因-> 带有 svg 图像的宽度动画对于 IE 来说是个问题。希望有人能解释一下,我也很好奇。:)
jQuery:
var remaining_height = parseInt($(window).height());
$('.main').height(remaining_height);
$('#panel1').hover(function() {
$('#panel2').stop(true, false, false).animate({ left: "66.66%"}, 350),
$('#panel3').stop(true, false, false).animate({ left: "83.33%"}, 350);
// $(this).stop(true, false, false).animate({width:'66.66%'}, 350)
}, function() {
// $(this).stop(true, false, false).animate({width:'33.33%'}, 350),
$('#panel2').stop(true, false, false).animate({ left: "33.33%"}, 350),
$('#panel3').stop(true, false, false).animate({ left: "66.66%"}, 350);
});
$('#panel2').hover(function() {
// $('#panel1').stop(true, false, false).animate({width:'16.666%'}, 350),
$('#panel3').stop(true, false, false).animate({ left: "83.33%"}, 350),
$(this).stop(true, false, false).animate({left: "16.666%"}, 350);
}, function() {
$(this).stop(true, false, false).animate({left: "33.33%"}, 350),
// $('#panel1').stop(true, false, false).animate({width:'33.33%'}, 350),
$('#panel3').stop(true, false, false).animate({left: "66.66%"}, 350);
});
$('#panel3').hover(function() {
// $('#panel1').stop(true, false, false).animate({width:'16.666%'}, 350),
$('#panel2').stop(true, false, false).animate({ left: "16.666%"}, 350),
$(this).stop(true, false, false).animate({left: "33.33%"}, 350);
}, function() {
$(this).stop(true, false, false).animate({left: "66.66%"}, 350),
// $('#panel1').stop(true, false, false).animate({width:'33.33%'}, 350),
$('#panel2').stop(true, false, false).animate({left: "33.33%"}, 350);
});