在此菜单中,悬停的 div 正在扩展,所有其他元素正在缩小
更改大小时菜单右侧有一个小摆动,这真的很烦人
我已经看到了:使用从中心扩展的 CSS 从中间扩展 div 而不是从顶部和左侧 扩展,他们还提到了摆动
有没有办法解决摆动?
这是我的代码
如您所见,速度始终相同,因此理论上不应该摆动
function add() {
var speed = 50;
$('.space').hover(
function() {
var n = this.id.replace(/[^\d]/g, '');
$('#space_' + n).removeClass('contract');
$('#space_' + n).stop().animate({
height: "107px",
width: "107px",
}, speed, 'linear');
$('.contract').stop().animate({
height: "73px",
width: "70px",
}, speed, 'linear');
},
function() {
var n = this.id.replace(/[^\d]/g, '');
$('#space_' + n).addClass('contract');
if($('#space_' + n).hasClass('selected') != true) {
$('#space_' + n).stop().animate({
height: "73px",
width: "73px",
}, speed, 'linear');
}
$('.contract').stop().animate({
height: "73px",
width: "73px",
}, speed, 'linear');
}
);
}
add();
在这里您可以看到菜单示例:http: //mellroy.com/dean/
先感谢您