Trigger HelpShelf via JavaScript

By default HelpShelf loads when the page loads and from there, the widget is opened, closed and generally interacted with based on user interaction. However, from time to time you may find it helpful to trigger key actions (such as showing or hiding the HelpShelf widget) via a JavaScript method.

Available Methods

The following methods are supported:

Open the HelpShelf widget

By default the HelpShelf widget is opened when a user clicks the icon. To open it on demand, use the method below.

HelpShelfLoader.showHelpShelf();

Close the HelpShelf widget

To manually close the HelpShelf Widget (rather than wait for the user to press the X icon), use the method below:

HelpShelfLoader.closeHelpShelf();

Show the Helpdesk / Contact widget

If you'd like to open the Helpdesk / Contact provider you have linked to your HelpShelf widget, use the method below. For instance, if you have setup Intercom as your Helpdesk provider, then by default we will display it to the user when they press the 'Contact' button within your widget. With this method you can manually make it visible and available to the user.

HelpShelfLoader.showHelpDesk();

Show the HelpShelf button

If you'd like to hide the HelpShelf button, use the method below. Please note however, that if it is hidden your website users will not be able to open it or invoke your Helpdesk / contact provider.

HelpShelfLoader.showHelpShelfBtn();

Hide the HelpShelf button

If needed, you can hide the HelpShelf button by using the method below.

HelpShelfLoader.hideHelpShelfBtn();

Destroy the HelpShelf widget

If needed, you can destroy (clear out) the entire HelpShelf widget by using the method below.

HelpShelfLoader.destroy();

Start the HelpShelf widget

If you have destroyed the HelpShelf widget (see above destroy method) and need to re-start the widget, call the method below.

HelpShelfLoader.start();

Using the above methods:

The above methods can either be encapsulated within your own JavaScript method or event, such as:

$("#my-element").on("click", function() {

HelpShelfLoader.showHelpShelf();

});

Or they can be triggered directly from an anchor element, such as:

<a href="javascript: HelpShelfLoader.showHelpShelf();">Open HelpShelf</a>


How did we do?


Powered by HelpDocs (opens in a new tab)

Powered by HelpDocs (opens in a new tab)