I'm trying to hide the Web Widget on mobile and use a button to open it
<a href="javascript:$zopim.livechat.window.show();">Help</a>
The script is as follows:
<script>
var script = document.createElement('script');
script.id = 'ze-snippet';
script.src = 'https://static.zdassets.com/ekr/snippet.js?key=cheesecake';
document.head.appendChild(script);
if ($(window).width() < 600) {
<-- Code to hide here -->
}
I've tried:
(1)
window.zESettings = {
webWidget: {
chat: {
suppress: true
},
}
};
(2)
zE(function() {
zE.hide();
});
(3)
$zopim(function() {
$zopim.livechat.button.hide();
});
It must be possible, as create a link with the below, hides it as desired.
<a href="javascript:$zopim.livechat.window.hide();">Hide</a>