Run javascript function on button press

Hi,

I would like to run the following javascript when a Button is pressed:
$zopim.livechat.window.show();

Any ideas on how to do this?

Hi there,

Thanks for writing in.

The $zopim variable is only accessible if it’s public, it’s best to contact zopim developers. But it should be something like this

jQuery('.button-class').on('click',  function() {
$zopim.livechat.window.show();
} );

And again, it will only work if the variable is accessible globally.

Tanks!

Hi,

So I should add the jQuery code to Custom -> Edit Global Javascript?

I guess “.button-class” should be changed to whatever class my button has. How do I set the class of a button in Cornerstone?

Hi there,

Yes, you should add the jQuery code to Custom -> Edit Global Javascript.

And you’re right about .button-class. You need to change it according to your own button class. To set a custom button class, see the 2nd para here https://theme.co/apex/forum/t/customizations-implementing-additional-button-colors/206

Best regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.