JS Custom the Background of Absolute Block

  • Last update:December 16, 2020
  • I. Overview

    In dashboards, there are no options to set the styles of absolute block, so users cannot directly modify the style attributes such as its border, background color, transparency, and background image. How can I modify these styles?

    II. Example

    2.1 Report design

    Create a new dashboard and add two absolute blocks, as shown in the following figure:

    1606381119436998.png


    2.2 Picture preparation

    Save the background image image1.jpg in folder %FR_HOME%\webapps\webroot\scripts\css, as shown in the following figure:

    1606381154242116.png

    Click to download image1.jpg:

    image1.jpg


    2.3 Add event

    Select the absolute block absolute0 and add an After Initialization event, as shown in the following figure:

    1606381212438717.png

    The JS code is as follows:

    setTimeout(function() {
      $("div[widgetname='ABSOLUTE0']").css("border", "5px solid black"); //Set the border thickness, line type and color of absolute0
      $("div[widgetname='ABSOLUTE0']").css("opacity", "0.5"); //Set the opacity of absolute0 to 0.5
      $("div[widgetname='ABSOLUTE0']").css("background", "pink"); //Set the background color of absolute0 to pink
      $("div[widgetname='ABSOLUTE1']").css('background', 'url(http://localhost:8075/webroot/scripts/css/image1.jpg)'); 
      //Set the background of absolute1 to the picture image1.jpg, which can be modified according to the actual situation
    }, 20);

    III. Effect preview

    Save and preview the template. The preview effect on the PC side is as shown in the figure below:

    1606381234839161.png

    Note: Mobile terminal is not supported.

    IV. Completed Template

    Attachment List


    Theme: FineVis Data Visualization
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy