gpt4 book ai didi

html - 使 dijit.Dialog 在显示时透明

转载 作者:行者123 更新时间:2023-11-28 13:33:20 25 4
gpt4 key购买 nike

我有一个 Dojo Dialog box使用 dijit.Dialog图书馆。它出现在 RowclickDojo grid 事件.现在,当它出现时,我希望它是透明的或降低它的不透明度,这样无论我的背景是什么,我都可以看到它并且看起来不错。我的对话框很简单 <div> with data-dojo-type="dijit.Dialog" .

代码是::

<div id="terms" name ="hi" data-dojo-type="dijit.Dialog" style="height:580px;width:900px;" data-dojo-props="title:'Control Activities'" preload="true">
<center><p><strong>EDIT AN ACTIVITY </strong></p></center>
<center><table>
<tr style="height: 50px">
<td style="width: 150px" align="right"><b>ASSIGNED BY : &nbsp&nbsp&nbsp</b></td>
<td style="width: 600px" align="left"><div id="plets"><input dojoType="dijit.form.ValidationTextBox" id="dassignedbyid" name="dassignedbyname" onfocus="hello()" required="true"></div>
<span dojoType="dijit.Tooltip" connectId="dassignedbyid">Enter Name</span></td>
<td style="width: 150px" align="right"><b>ASSIGNED TO : &nbsp&nbsp&nbsp</b></td>
<td style="width: 600px" align="left"><div id="plets1"><input dojoType="dijit.form.ValidationTextBox" id="dassignedtoid" name="dassignedtoname" onfocus="hello()" required="true"></div>
<span dojoType="dijit.Tooltip" connectId="dassignedtoid">Enter Name</span></td></tr>
</table></center>
</div>

还有 Dialog box id= terms出现在这段代码中::

dojo.connect(grid, "onRowClick", grid, function(){
var items = grid.selection.getSelected();
dojo.forEach(items, function(item){

var v = grid.store.getValue(item, "ActID");
getdetailsfordialog(v);
function showDialog(){
dojo.require('dijit.Tooltip');
dijit.byId("terms").show();
document.getElementById('closelabelspan').style.display = 'none';
document.getElementById('holdlabelspan').style.display = 'none';
document.getElementById('startlabelspan').style.display = 'none';
document.getElementById('cancellabelspan').style.display = 'none';
document.getElementById('updatelabelspan').style.display = 'none';
}

showDialog();
}, grid);
});

现在我想要这个 dialog box(terms)弹出它是透明的。我也尝试过一种 CSS,但这对我不起作用::

<style>
div.transbox
{
width:900px;
height:580px;
background-color:#FFFFFF;
border:2px solid black;
opacity:0.6;
filter:alpha(opacity=60); /* For IE8 and earlier */

}
</style>

我正在使用 IE8。

如何做到这一点?谢谢..

函数showDialog()编辑::

function showDialog(){
dojo.require('dijit.Tooltip');
dijit.byId("terms").on("show", function() { dojo.style(this.domNode, "opacity", 0.3); });
dijit.byId("terms").show();
document.getElementById('closelabelspan').style.display = 'none';
document.getElementById('holdlabelspan').style.display = 'none';
document.getElementById('startlabelspan').style.display = 'none';
document.getElementById('cancellabelspan').style.display = 'none';
document.getElementById('updatelabelspan').style.display = 'none';
}

最佳答案

程序化

    var dia = new dijit.Dialog({
title: "Click me!",
onShow: function() {
var me = this;
// show routine sets opacity to 1, wait till it has and reset
// second style call sets the underlay as well
setTimeout(function() {
dojo.style(me.domNode, "opacity", 0.4);
dojo.style(dojo.byId(me.underlayAttrs.dialogId + me.underlayAttrs["class"]), "opacity", 0.4);
}, 1000);
},
content: 'simple contents'
});
dia.startup();
dia.show();

通过标记;

<div data-dojo-type="dijit.Dialog" style="height:580px;width:900px;" 
data-dojo-props="title:'Control Activities'" preload="true">

<script type="dojo/method" data-dojo-event="onShow" data-dojo-args="">
var me = this;
// show routine sets opacity to 1, wait till it has and reset
// second style call sets the underlay as well
setTimeout(function() {
dojo.style(me.domNode, "opacity", 0.4);
dojo.style(dojo.byId(me.underlayAttrs.dialogId + me.underlayAttrs["class"]), "opacity", 0.4);
}, 1000);
</script>
</div>

关于html - 使 dijit.Dialog 在显示时透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10793551/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com