Advertisement
Guest User

Untitled

a guest
Mar 31st, 2022
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. GorgiasChat.init().then(function() {
  3.  
  4.   GorgiasChat.on('ready', function(){
  5.     var chatButtonIframe = document.querySelector('#chat-button');
  6.     chatButtonIframe.style="display:none;"
  7.    
  8.     // replace our button with your own
  9.     var myButton = document.createElement('button');
  10.     myButton.style = `
  11.       position: fixed;
  12.       right: 22px;
  13.       bottom: 10px;
  14.       z-index: 2147483000;
  15.       width: 50px;
  16.       height: 50px;
  17.       border-radius: 10px;
  18.       background-color: blue;
  19. display: none;
  20.     `
  21.    
  22.     // onClick, behave like a chat opener
  23.     myButton.onclick = function(){
  24.       if (GorgiasChat.isOpen()) {
  25.         GorgiasChat.close();
  26.       } else {
  27.         GorgiasChat.open();
  28.       }
  29.     }
  30.    
  31.     document.body.appendChild(myButton);
  32.    
  33.   });
  34.    
  35. })
  36. </script>
  37.   <script>
  38.   GorgiasChat.init().then(function() {
  39.   GorgiasChat.on('widget:opened', () => {
  40.     document.querySelector('#gorgias-chat-container iframe#chat-button').style.display = 'block'
  41.   })
  42.   GorgiasChat.on('widget:closed', () => {
  43.     document.querySelector('#gorgias-chat-container iframe#chat-button').style.display = 'none'
  44.   })
  45. })
  46.   </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement