Creating a see-through effect for dijit.Dialog as it appears

Utilizing the dijit.Dialog library, I have implemented a Dojo Dialog box that appears on a Rowclick event of a Dojo grid. I am looking to make the Dialog box transparent or reduce its opacity so that the background is visible and it looks visually appealing. The Dialog box is a simple

<div> with data-dojo-type="dijit.Dialog"
.

Here is the code snippet:

<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>

The Dialog box id= terms is triggered by this code:

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);
      });

To make the dialog box(terms) transparent, I attempted to implement CSS without success:

<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> 

I am using IE8 and seeking guidance on achieving transparency. Thank you.

Edited function showDialog() snippet:

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';
            }

Answer №1

Using a programmed approach:

    var dialog = new dijit.Dialog({
        title: "Click me!",
        onShow: function() {
            var self = this;
            // The show routine sets opacity to 1, waits until it does, then resets
            // The second style call also sets the underlay
            setTimeout(function() {
                dojo.style(self.domNode, "opacity", 0.4);
                dojo.style(dojo.byId(self.underlayAttrs.dialogId + self.underlayAttrs["class"]), "opacity", 0.4);
            }, 1000);
        },
        content: 'simple contents'
    });
    dialog.startup();
    dialog.show();

Using markup:

<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 self = this;
            // The show routine sets opacity to 1, waits until it does, then resets
            // The second style call also sets the underlay
            setTimeout(function() {
                dojo.style(self.domNode, "opacity", 0.4);
                dojo.style(dojo.byId(self.underlayAttrs.dialogId + self.underlayAttrs["class"]), "opacity", 0.4);
            }, 1000);
   </script>
</div>

Answer №2

The stylesheet for dijit dialog contains a class called .dijitDialogUnderlay. To modify the background color of this class, update the "background-color" property to: background-color: #0000;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Filtering elements upon loading

I have successfully implemented data filtering on my website using data-filter. While everything is working great, I am interested in displaying items with specific attributes upon loading. For instance, I want to load only green objects by default inste ...

The clip-path in Div: Css is malfunctioning and not displaying correctly

I am trying to create a chat bubble using CSS with rounded corners and a bottom-right arrow. However, I am having trouble getting the arrow to display correctly. https://i.stack.imgur.com/gVXOV.png The CSS styling for the chat bubble is as follows: ...

How can I show the table row as an inner table row when the first field is identical?

<tr ng-model="check" ng-repeat="orderBook in orderBookDetails| orderBy: 'orderBook.no'" value='check=$scope.orderBookDetails.sowNo'> <td ng-if='check!=orderBook.no'>{{orderBook.no}}</td> <td>{{order ...

When extracting information from a table within a Vue.js and Vuetify.js function

When trying to display a table, only one row is being printed. How can I resolve this issue? I have attempted various solutions (Vanilla JS worked). This project is for educational purposes and I am relatively new to JS and Vue.js. <template> < ...

Struggling to understand how to assign a specific color to individual divs within a loop

Featured on the main page of my website are 3 posts, each accompanied by a div link below. I want each of these 3 divs to have a distinct color. Any new posts within this category will appear here as they are published, but only the latest three will be vi ...

The spacing between images on mobile devices is excessive

My images on mobile have too much space between them: mobile version They appear fine in Dev Tools: dev tools version This is my HTML: <div class="container-fluid"> <!-- <br> --> <div class="row"> ...

Extract particular details from my database

I need help creating a table to display all chat messages sent to the server. I have the table set up, but now I want to make it so that when I click on a user's name like 'demo', it will show me all the chat messages sent by that specific u ...

What is the best way to implement a secondary sticky navbar that appears on scroll of a specific section, positioned below the primary fixed-top navbar, using jQuery and Bootstrap 5?

I am facing a challenge with my webpage layout. I have a fixed-top navbar at the top, followed by 3 sections. The second section contains nav-tabs. What I want is for the nav-tabs navbar to stick to the top of the page below the fixed-top navbar when the u ...

Troubleshooting problem with CSS layout when adjusting the height of a section

I recently delved into creating a simple website using HTML5 and have successfully set up the site structure. Everything has been smooth sailing so far. However, I've encountered a section of the site that seems to have a mind of its own. When I ass ...

"Utilize Tailwind to effortlessly place a single item at the center

Looking for a way to align a row of items with one item centered in the div and the others positioned on either side while maintaining their original order? Check out this code snippet: <div className="flex mx-auto justify-center items-center" ...

Tips for closing the navbar by clicking elsewhere on the page

Is there a way to modify my code in order for the navbar to close when clicking outside of it, while staying open if something inside it is clicked? $(document).ready(function() { $('.nav-btn').on('click', function() { $('.na ...

Utilizing HTML and CSS allows for creating a responsive layout with three elements such as this

Need help with CSS to align three elements in a row, where the first two are on the left and the third is on the right. The layout should adjust so that when the window size is smaller, the second element moves below the first while the third element stays ...

The Google Maps App fails to launch now

Recently, my map started experiencing issues. The problem seems to be related to the HTML using a javascript and css file that is loaded from Google Drive for display. However, when I directly load these files from my computer, it works perfectly fine. Bel ...

Error sound produced when detecting KeyCode on the keyboard

I'm currently working on a JavaScript project that involves capturing keyboard input. However, I'm encountering an issue where every time the user presses a key, it triggers an error sound. Is there a way to disable this sound? ...

If a user types in Korean characters in the input field and then clicks away to any other part of the screen, the input field will automatically regain focus

jsfiddle instructions for testing: type Korean characters in the input field scroll down until the input field is no longer visible Click anywhere on the screen Expected result: the input field will come into focus with (Korean text) If the user enters K ...

Enhancing the window.print() Functionality

I recently utilized the window.print() function to print a web page containing a table. The headers of the table were styled with font color, however when printed, they appeared black instead. Below is the code snippet: <thead> <tr style="color:r ...

Achieving a scrolling body with a fixed header in a Vue b-table

Currently, I have implemented a b-table element on a webpage to display data from a database. The table is paginated, but feedback suggests that users prefer all information displayed in a single scrolling view. However, the issue arises when I attempt to ...

Initiate a function following a 3-second click on an image

I'm facing a peculiar challenge with my website - I have an invisible button that needs to be pressed for 3 seconds in order to trigger a specific action. Here is what I've attempted so far: $("#basicChn").on({ mousedown: function() { $ ...

Are the elements in Chrome overlapping due to the box model?

I'm currently experiencing a problem of cross-browser compatibility between Chrome and Firefox. Upon inspecting the webpage in Chrome, it's evident that the box for the #content DIV is overlapping with the box for the H3. When viewed in Firefox ...

"Rotated element in Opera does not maintain event functionality when positioned outside its

Make sure to test this example on Opera (version 12.02) by clicking this link. In Opera, try clicking the red box inside the blue box (event is triggered), then click the red box outside the blue box (event isn't triggered). The container must have p ...