gpt4 book ai didi

jQuery 向左 move

转载 作者:太空宇宙 更新时间:2023-11-03 22:00:50 30 4
gpt4 key购买 nike

我正在尝试向子菜单添加一个不错的小效果,但我不能使用 marginLeft,因为它会弄乱容器。所以我试图通过使用 left 而不是 marginLeft 来实现它,但我无法让它工作......任何想法为什么?

$('#order_list li').hover(function(){
$(this).stop().animate({ "left": "14px" }, 250, function() {
$(this).animate({ "left": "10px" }, 250);
});
},function(){
$(this).stop().animate({ "left": "4px" }, 250, function() {
$(this).animate({ "left": "0px" }, 250);
});
});

最佳答案

CSS Left仅适用于 positioned元素。

尝试将 position:relative; 添加到 li

例如

#order_list li {
position: relative;
}

关于jQuery 向左 move ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10635601/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com