$zopim.livechat.window
Customize and control the chat window.
$zopim. | Customize and control the chat window. |
Functions | |
setColor | Set the color of the widget. |
setSize | Set the size of the chat window. |
show | Show the chat window. |
hide | Hide the chat window. |
onShow | Register a callback to be fired when the chat window is shown. |
onHide | Register a callback to be fired when the chat window is hidden. |
setTitle | Set the title of the chat window. |
toggle | Toggle the visibility of the chat window. |
getDisplay | Get the current visibility of the chat window. |
setOffsetVertical | Set the vertical offset of the chat window from the edge of the browser window. |
setOffsetHorizontal | Set the horizontal offset of the chat window from the edge of the browser window. |
setPosition | Set position of the chat window. |
openPopout | Attempts to open the live chat widget in a new window. |
setColor
Set the color of the widget.
Important: This function is deprecated and may be removed in the future. Use “$zopim.livechat.theme.setColor” instead.
Note: theme.reload must be called after setColor for changes to take effect (see example below).
Parameters
color | Widget color, in hexadecimal format (‘#AABBCC’) |
Example
<script> $zopim(function() { $zopim.livechat.window.setColor('#FFCC00'); $zopim.livechat.theme.reload(); // apply new theme settings }); </script>
setSize
Set the size of the chat window. Allowed values: small, medium, large.
Parameters
size | Chat window size (string) |
Example
Select size: <a href="javascript:void($zopim.livechat.window.setSize('small'))">Small</a> <a href="javascript:void($zopim.livechat.window.setSize('medium'))">Medium</a> <a href="javascript:void($zopim.livechat.window.setSize('large'))">Large</a>
show
function show()
Show the chat window.
Mobile Widget (non-overlay mode only)
- If on a mobile device, attempts to open the live chat widget in a new window instead.
- May not work on some devices or configurations.
- Important: Should only be called from a user event listener callback. See example for openPopout.
Example
<script> $zopim(function() { $zopim.livechat.window.show(); }); </script>
setOffsetVertical
function setOffsetVertical( distance )
Set the vertical offset of the chat window from the edge of the browser window.
Parameters
distance | Distance from the edge of the browser window, in pixels (number) |
Example
<script> $zopim(function() { $zopim.livechat.window.setOffsetVertical(20); }); </script>
setOffsetHorizontal
function setOffsetHorizontal( distance )
Set the horizontal offset of the chat window from the edge of the browser window.
Parameters
distance | Distance from the edge of the browser window (in pixels) |
Example
<script> $zopim(function() { $zopim.livechat.window.setOffsetHorizontal(30); }); </script>
setPosition
function setPosition( position )
Set position of the chat window.
Allowed values
- br (Bottom right)
- bl (Bottom left)
- tr (Top right)
- tl (Top left)
Parameters
position | Chat window position (string) |
Example
Select chat window position: <a href="javascript:void($zopim.livechat.window.setPosition('br'))">Bottom right</a> <a href="javascript:void($zopim.livechat.window.setPosition('bl'))">Bottom left</a> <a href="javascript:void($zopim.livechat.window.setPosition('tr'))">Top right</a> <a href="javascript:void($zopim.livechat.window.setPosition('tl'))">Top left</a>
openPopout
function openPopout()
Attempts to open the live chat widget in a new window. On the mobile widget, this API will ignore the “Overlay Window” setting in dashboard and open a new window/tab. If simply showing the mobile overlay window is the intended behavior, use “$zopim.livechat.window.show” instead.
May not work on some devices or configurations.
Important: Should only be called from a user event listener callback. See example.
Example
<a href="javascript:void($zopim.livechat.window.openPopout())">Open chat in new window</a>
Show the chat window.
function show()
Hide the chat window.
function hide()
Register a callback to be fired when the chat window is shown.
function onShow( callback )
Register a callback to be fired when the chat window is hidden.
function onHide( callback )
Set the title of the chat window.
function setTitle( title )
Toggle the visibility of the chat window.
function toggle()
Get the current visibility of the chat window.
function getDisplay()
Set the vertical offset of the chat window from the edge of the browser window.
function setOffsetVertical( distance )
Set the horizontal offset of the chat window from the edge of the browser window.
function setOffsetHorizontal( distance )
Set position of the chat window.
function setPosition( position )
Attempts to open the live chat widget in a new window.
function openPopout()