Jump to content

Recommended Posts

Posted

Hello,

I used this code inside CustomCSS in ServerModule to change mask message to image :

  .x-mask-msg{
       background:none;
       border-width:0px;
    }
    .x-mask-msg-inner{
       border-width:0px;
       color:none;
       padding:50px;
       background: rgba(0, 0, 0, 0);
       background-image:url(files/loading.gif);
       background-repeat:no-repeat;
       background-size: contain;
    }
    .x-mask-msg-text{
       display:none;
       background-image:none;
    }

Can i change it from image to text at runtime ?

Thanks.

Posted

Hello,

36 minutes ago, Mohammed Nasman said:

Can i change it from image to text at runtime ?

Solution:

1. MainForm.Script ->

function setMaskImage() {
    if (!document.getElementById('customMaskStyle')) {
        var sheet = document.createElement('style');
        sheet.innerHTML =
          ".x-mask-msg {\
              background: none !important;\
              border-width: 0px !important;\
           }\
          .x-mask-msg-inner {\
              background: rgba(0,0,0,0) !important;\
              background-image: url(files/loading.gif) !important;\
              background-repeat: no-repeat !important;\
              background-size: contain !important;\
              padding: 50px !important;\
          }\
          .x-mask-msg-text {\
              display: none !important;\
          }";
        sheet.id = "customMaskStyle";
        document.head.appendChild(sheet);
    }
}
function restoreMaskText() {
    var custom = document.getElementById('customMaskStyle');
    if (custom) custom.remove();
}
setMaskImage(); //Call setMaskImage() to apply the image mask right away.

2. Usage:

setMaskImage();      // Switches mask to show an image instead of text
restoreMaskText();   // Restores the default mask with text

 

  • Like 1
  • Mohammed Nasman changed the title to Change Mask message to image at runtime
Posted
1 hour ago, Sherzod said:

Hello,

Solution:

1. MainForm.Script ->

function setMaskImage() {
    if (!document.getElementById('customMaskStyle')) {
        var sheet = document.createElement('style');
        sheet.innerHTML =
          ".x-mask-msg {\
              background: none !important;\
              border-width: 0px !important;\
           }\
          .x-mask-msg-inner {\
              background: rgba(0,0,0,0) !important;\
              background-image: url(files/loading.gif) !important;\
              background-repeat: no-repeat !important;\
              background-size: contain !important;\
              padding: 50px !important;\
          }\
          .x-mask-msg-text {\
              display: none !important;\
          }";
        sheet.id = "customMaskStyle";
        document.head.appendChild(sheet);
    }
}
function restoreMaskText() {
    var custom = document.getElementById('customMaskStyle');
    if (custom) custom.remove();
}
setMaskImage(); //Call setMaskImage() to apply the image mask right away.

2. Usage:

setMaskImage();      // Switches mask to show an image instead of text
restoreMaskText();   // Restores the default mask with text

 

Thanks, it works!

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...