我试图给子菜单添加一个小的漂亮的效果,但是我不能使用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);
});
});发布于 2012-05-17 20:20:05
CSS Left仅适用于positioned元素。
尝试向li添加position:relative;。
例如:
#order_list li {
position: relative;
}发布于 2012-05-17 20:20:12
$('#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);
});
});https://stackoverflow.com/questions/10635601
复制相似问题