I implemented zopim in a site and had to change class of a div according to the current agent's status.
<script type="text/javascript">
//YOUR ZOPIM SCRIPT HERE
</script>
//updatestatus function
function updateStatus(s) //NOTICE "s" here it contains agent's current status
{
switch(s)
{
case 'online':
jQuery('.chatbox').addClass('online');
break;
case 'offline':
jQuery('.chatbox').removeClass('online');
break;
case 'away':
jQuery('.chatbox').removeClass('online').addClass('away');
break;
}
<div class="chatbox" onclick="$zopim.livechat.window.toggle();">sow chat</div>
<script type="text/javascript">
//YOUR ZOPIM SCRIPT HERE
</script>
$zopim(function() {
$zopim.livechat
.setOnStatus(updateStatus);
});
.setOnStatus(updateStatus);
});
//updatestatus function
function updateStatus(s) //NOTICE "s" here it contains agent's current status
{
switch(s)
{
case 'online':
jQuery('.chatbox').addClass('online');
break;
case 'offline':
jQuery('.chatbox').removeClass('online');
break;
case 'away':
jQuery('.chatbox').removeClass('online').addClass('away');
break;
}
No comments:
Post a Comment