hide custom chat button when no are agents online

Respondida

4 Comentarios

  • Ramin Shokrizadeh
    Acciones de comentarios Permalink

    Hi Sam,

    Since you are using the Web Widget, you will need to wrap the JS code in a zE function.

    You can look at this post to learn more: https://support.zendesk.com/hc/en-us/articles/115007912068-Using-the-Chat-widget-JavaScript-API

    Thanks,

    Ramin

    1
  • Sam Germein
    Acciones de comentarios Permalink

    @Ramin

     

    thanks for this, I will take a look

    -1
  • Sam Germein
    Acciones de comentarios Permalink

    @Ramin

    thanks for your help, I managed to get it working with

    // JavaScript source code
    $(document).ready(function () {
    zE(function () {

    $zopim(function () {


    $zopim.livechat.setOnStatus(check);


    function check(status) {
    if (status == 'offline') {
    $("#div").css({ "display": "none" });
    }

    else if (status == 'online') {
    $("#div").css({ "display": "inline-block" });
    }
    }


    });

    });

    });

     

    The only question is I am not sure if the (document).ready is actually doing anything here? I doesn't seem to affect the functionality, can you comment?

     

    Sam

    0
  • Ramin Shokrizadeh
    Acciones de comentarios Permalink

    Hi Sam, 

    Don't think it is required, usually the zE function is all that is required.

    -Ramin

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk