Javascript API
New Widget
$zopim.livechat.button
Customize and control the chat button.
Summary
$zopim. | Customize and control the chat button. |
Functions | |
setColor | Set the color of the widget. |
setHideWhenOffline | Configure whether the chat button is displayed when the account is offline. |
hide | Hide the chat button. |
show | Show the chat button. |
setOffsetVertical | Set the vertical offset of the chat button from the edge of the browser window. |
setOffsetVerticalMobile | Set the vertical offset of the chat button on mobile from the edge of the browser window. |
setOffsetHorizontal | Set the horizontal offset of the chat button from the edge of the browser window. |
setOffsetHorizontalMobile | Set the horizontal offset of the chat button on mobile from the edge of the browser window. |
setPosition | Set position of the chat button. |
setPositionMobile | Set the position of the chat button on mobile devices. |
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.button.setColor('#FFCC00'); $zopim.livechat.theme.reload(); // apply new theme settings }); </script>
setOffsetVertical
function setOffsetVertical( distance )
Set the vertical offset of the chat button 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.button.setOffsetVertical(20); }); </script>
setOffsetVerticalMobile
function setOffsetVerticalMobile( distance )
Set the vertical offset of the chat button on mobile 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.button.setOffsetVerticalMobile(20); }); </script>
setOffsetHorizontal
function setOffsetHorizontal( distance )
Set the horizontal offset of the chat button 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.button.setOffsetHorizontal(30); }); </script>
setOffsetHorizontalMobile
function setOffsetHorizontalMobile( distance )
Set the horizontal offset of the chat button on mobile 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.button.setOffsetHorizontalMobile(30); }); </script>
setPosition
function setPosition( position )
Set position of the chat button.
Allowed values
- br (Bottom right)
- bm (Bottom middle)
- bl (Bottom left)
- tr (Top right)
- tm (Top middle)
- tl (Top left)
Parameters
position | Chat button position (string) |
Example
Select chat button position: <a href="javascript:void($zopim.livechat.button.setPosition('bl'))">Bottom left</a> <a href="javascript:void($zopim.livechat.button.setPosition('bm'))">Bottom middle</a> <a href="javascript:void($zopim.livechat.button.setPosition('br'))">Bottom right</a> <a href="javascript:void($zopim.livechat.button.setPosition('tl'))">Top left</a> <a href="javascript:void($zopim.livechat.button.setPosition('tm'))">Top middle</a> <a href="javascript:void($zopim.livechat.button.setPosition('tr'))">Top right</a>
Configure whether the chat button is displayed when the account is offline.
function setHideWhenOffline( bool )
Hide the chat button.
function hide()
Show the chat button.
function show()
Set the vertical offset of the chat button from the edge of the browser window.
function setOffsetVertical( distance )
Set the vertical offset of the chat button on mobile from the edge of the browser window.
function setOffsetVerticalMobile( distance )
Set the horizontal offset of the chat button from the edge of the browser window.
function setOffsetHorizontal( distance )
Set the horizontal offset of the chat button on mobile from the edge of the browser window.
function setOffsetHorizontalMobile( distance )
Set position of the chat button.
function setPosition( position )
Set the position of the chat button on mobile devices.
function setPositionMobile( position )