Additional Widget Options

Within the code generated by Airdesk, you can add extra widget handling options.

Example of a code generated by Airdesk that is placed on the client's page:

 <script defer> 

      (function (a, i, r, d, e, s, k) { 

        a.airdesk = { settings: { cpid: "TEST-EXAMPLE" } }; 

        e = i.getElementsByTagName("head")[0]; 

        s = i.createElement("script"); 

        s.async = 1; 

        s.src = r + d; 

        e.appendChild(s); 

        a.$airdeskOnLoad = () => { 

          var {$airdesk} = a;

//Extra options are added below this line 

}; 

      })(window, document, "https://script.airdesk.ai/v1/", "air.js"); 

    </script> 

Option

Explanation

$airdesk.open()

The widget will open the form automatically as soon as it's ready.

$airdesk.close()

The widget closes the form.

$airdesk.language(CODE)

If the user doesn't have a language already saved. This option allows you to choose a starting language, instead of choosing the starting language depending on the browser's language. Examples of CODE "en-GB", "pt-PT", "en-ES".

$airdesk.position(STRING)

Changes the initial positioning to a pre-effect.

$airdesk.position('bl')

Changes the widget's positioning to the lower left corner.

$airdesk.right(NUMBER)

Replaces the initial positioning of the widget button on the right. The positioning is done on px basis.

$airdesk.left(NUMBER)

Replaces the initial positioning of the widget button on the left. The positioning is done on px basis.

$airdesk.bottom(NUMBER)

Replaces the initial positioning of the widget button vertically starting from below. The positioning is done on a px basis.

$airdesk.top(NUMBER)

Replaces the initial positioning of the widget button vertically starting at the top. The positioning is done on a px basis.

$airdesk.hidden()

Hide the page widget. It no longer allows to press the button and open the form.

$airdesk.visible()

Shows the widget that has been hidden.

To use widget functions with javascript, these must always be called within a load event.

window.addEventListener ('load', function () {})

You can call up these options after initialization of the widget like for example make the widget, after loading on the page, automatically open the form as follows:

 <script defer> 

      (function (a, i, r, d, e, s, k) { 

        a.airdesk = { settings: { cpid: "TEST-EXAMPLE" } }; 

        e = i.getElementsByTagName("head")[0]; 

        s = i.createElement("script"); 

        s.async = 1; 

        s.src = r + d; 

        e.appendChild(s); 

        a.$airdeskOnLoad = () => { 

          var {$airdesk} = a;

//Opções extra são adicionadas abaixo desta linha 

$airdesk.open() 

}; 

      })(window, document, "https://script.airdesk.ai/v1/", "air.js"); 

    </script> 

Or, it's also possible to call the options in the client's javascript after the widget is initialized, as follows:

window.$airdesk.open(); 

Last updated