onSoundSwitch ( data )

Activates when the visitor turns the chat widget sounds on/off.

Will be useful to ensure visual indication of the fact that the switch was successfully made in the chat widgets created by way of uploading own HTML code. In the standard NetroxSC windows automatic inscription replacement on the switch button is used for such indication.

The "data" object is passed as an argument, containing the following properties:

PropertyTypeDescription
state integer New state of the switch. 0 -- sound off, 1 -- sound on

Examples

  1. Using jQuery
    $(document).on("netroxsoundswitch", function(event, data) {
        if (data.state) {  
            // Your actions upon activation
        } else {           
            // Your actions upon deactivation
        }
    });       
  2. Using the nsc_API object
    nsc_API = { /* ... */ };
    
    nsc_API.onSoundSwitch = function(data) {
        if (data.state) {  
            // Your actions upon activation
        } else {           
            // Your actions upon deactivation
        }
    };        

All rights reserved. Copyright © 2017 Netrox SC
Host CMS