0

我正在做这样的事情来使对话框出现,并显示一个 .gif 图像,它基本上是一个微调器,指示用户等待。

$("#loading").dialog({
                height: 140,
                width:160,
                modal: true,
                resizable : true,
                draggable : true,
                closeOnEscape: false
           });

$(".ui-dialog-titlebar").hide();   //No title bar
$(".ui-dialog").css("padding","0px");  //Remove extra spacing

此代码显示微调器,隐藏标题栏但没有摆脱背景图像,因此看起来很尴尬。有没有办法使用jQuery摆脱背景?

我不想过多地弄乱 css,因为我希望其他对话框看起来很标准。

谢谢!

4

3 回答 3

2

我不确定哪个元素有背景图像,这是摆脱背景图像的常用方法

$(SELECTOR).css('background', 'none');

或者

$(SELECTOR).css('background-image', 'none');
于 2012-09-23T15:30:48.557 回答
1

您可以使用

.dialog( "close" )

参考:

http://jqueryui.com/demos/dialog/#method-close

编辑:

除非你希望它仍然显示,这意味着我误解了这个问题(对不起)。你可以做一些事情来获得没有背景:

jQuery UI 对话框覆盖

于 2012-09-23T15:27:30.853 回答
0

这对我有用:

jQuery 用户界面:

$("#div_loading").dialog({
  autoOpen:      false,
  modal:         true,
  dialogClass:   "no-close",
  draggable:     false,
  resizable:     false,
  closeOnEscape: false,
  width:         "auto",
  height:        "auto"
});

//This removes the title bar
$(".ui-widget-header").css("background", "none");
$(".ui-widget-header").css("border", "none");

//This removes the background
$(".ui-widget-content").css("background", "none");
$(".ui-widget-content").css("border", "none");

注意:我使用autoOpen: false是因为对话框仅在单击按钮时打开。

HTML:

<div id="div_loading" >
  <img alt="" src="ajax-loader.gif">
</div>
于 2013-03-12T00:35:33.623 回答