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);
});
});