【发布时间】:2012-11-07 11:08:42
【问题描述】:
我有以下脚本,它将一些按钮(现在是假按钮)添加到 div:
$("<div class='divButtons'>").appendTo( $(this).closest(".widget").find(".widget_header") );
// not real buttons, just text at the moment. Trying to get the position right first.
$(".divButtons").text("(close), (min), (max), (help)").css({background:"red",float:"right"});
问题是,我不知道如何让divButtons 的右上角将自己定位到父.widget_header 的右上角。我尝试添加top:some_number_here,但是在使用jQueries ui-sortable 移动div 时效果不佳。
【问题讨论】:
-
如果你使用
css('right', 0)会怎样? -
@x4f4r,我刚刚试过这个
.css({background:"red",float:"right",right:"0px",top:"0px"});并没有什么不同。
标签: jquery jquery-ui jquery-selectors jquery-ui-sortable