Javascript functions
RepX exposes some JavaScript functions you can call from your own site to control the widget. These are useful when you want the RepX widget to be hidden on some pages, and have it open up only when users click on a button. Please note that these functions are case-sensitive.
Function
What it does
window.Repx.show()
Shows the widget on the page. This is the default: the widget always shows unless you tell it not to, so you rarely need to call this explicitly.
window.Repx.hide()
Hides the widget launcher from the page.
window.Repx.open()
Opens the full chat panel.
window.Repx.open("message")
Opens the full chat panel, with the message dropped into the chat. RepX starts responding to the message when the chat panel opens.
window.Repx.setOffset({ bottom: 20, right: 20 })
Use this function to offset the widget from its natural position.
bottom and right are optional - so you can use just one of those, if you prefer.
Negative values work as well - they move the widget in the opposite direction.
When to use these functions
If you want the RepX widget to open only when users click on a button, you would first hide the widget on load by going to Settings in Storylane dashboard. Then, when a button is clicked, using the onclick event, you'd call the function window.Repx.open() function to open the chat panel.
You'd rarely use the function window.Repx.show(). It's only to be used when you've embedded the widget on your website in such a way that it's hidden by default across several pages. On certain pages where you'd like to show the widget launcher, you'd invoke window.Repx.show() when the page loads, so that it shows up in those pages.
Last updated
Was this helpful?