jQuery向左移动

jQuery向左移动,jquery,html,css,move,Jquery,Html,Css,Move,我试图给一个子菜单添加一个小的好效果,但我不能使用marginLeft,因为它会把容器弄得一团糟。因此,我尝试使用left而不是marginLeft,但我无法让它工作。。。你知道为什么吗 $('#order_list li').hover(function(){ $(this).stop().animate({ "left": "14px" }, 250, function() { $(this).animate({ "left": "10px" }, 250); }); },f

我试图给一个子菜单添加一个小的好效果,但我不能使用
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);
  });
});
仅对元素有效

尝试添加
位置:相对
li

e、 g

仅对元素有效

尝试添加
位置:相对
li

e、 g


你的效果是在某个事件后向左移动“li”是吗?你的效果是在某个事件后向左移动“li”是吗?
#order_list li {
  position: relative;
}
$('#order_list li').hover(function(){
  $(this).stop().animate({ "textIndent": "14px" }, 250, function() {
    $(this).animate({ "textIndent": "10px" }, 250);
  });
},function(){
  $(this).stop().animate({ "left": "4px" }, 250, function() {
    $(this).animate({ "textIndent": "0px" }, 250);
  });
});