我在对话框中添加了两个自定义按钮,但它们目前只在中间。如何在标题栏上的关闭按钮旁移动这些按钮,而不覆盖或触摸关闭按钮,也不使用任何leftbuttoninv.onEnterFrame = function() {
if (Key.isDown(Key.LEFT)) {
rotation_answer=answer_left;
gotoAndPlay(2);
}
else if (Key.isDown(Key.RIGHT)) {
rotation_answer=answer_right;
gotoAndPlay(2);
}
}
?
答案 0 :(得分:1)
如果您乐意在jquery中使用内联样式,这可以获得您想要的(没有浮动或覆盖关闭按钮 - 只需将左边距设置为第一个自定义按钮:
$('<button>-</button>').appendTo(titlebar).css('margin-left', '35%').click(function() {
答案 1 :(得分:1)
如果您在jQuery中使用css,那么可以在减号按钮中添加一个类:
$('<button class="minusButton">-</button>').appendTo(titlebar).click(function() {
$('#resultId').parents('.ui-dialog').animate({
height: '40px',
top: $(window).height() - 90
}, 50);
});
然后设置保证金
$(".minusButton").css("margin-left", "105px");
答案 2 :(得分:0)
如果没有至少使用通过jQuery编写的内联CSS,绝对没有办法做到这一点。
您最好的选择是在+按钮上使用浮动和固定的小边距,这样它就不会与关闭按钮重叠。请注意,当用户大量调整对话框窗口大小时,这里写的任何答案都可能会出现问题,防止这种情况的唯一方法是给整个对话框窗口一个min-width
属性。
这是你应该做的:
$('<button>+</button>').appendTo(titlebar).css({'display':'inline-block', 'float':'right', 'margin-right': '10px'}).click...
另一个按钮:
$('<button>-</button>').appendTo(titlebar).css({'display':'inline-block', 'float':'right'}).click...
您可以看到工作Fiddle Here