Canales de atención
Webchat
Chat en nuevo tab
1min
// asisteclick com // este script en javascript vainilla muestra un botón de chat flotante // y abre el chat web en un nuevo tab // parámetros var chatbot url = "https //app asisteclick com/v3/request php?id=6851208 4237" var settings = window\ asisteclicksettings || {}; var text = settings text || 'estamos en línea! '; var textsize = settings textsize || '24px'; var textcolor = settings textcolor || '#ffffff'; var backgroundcolor = settings backgroundcolor || '#008cba'; var borderradius = settings borderradius || '50px'; // aumento del radio de borde para un diseño más redondo var width = settings width || '300px'; var height = settings height || '60px'; chatbot url = settings chatbot url || chatbot url; // construct the css string using the settings var css = '#asisteclick button { position fixed; bottom 20px; right 20px; background color ' + backgroundcolor + '; border none; color ' + textcolor + '; width ' + width + '; height ' + height + '; text align center; line height ' + height + '; font size ' + textsize + '; cursor pointer; border radius ' + borderradius + '; display flex; justify content center; align items center; padding 10px; box shadow 0px 0px 5px rgba(0, 0, 0, 0 3); transition all 0 3s ease; }' + '#asisteclick button\ hover { background color ' + shadecolor(backgroundcolor, 20) + '; transform translatey( 5px); box shadow 0px 5px 15px rgba(0, 0, 0, 0 2); }'; // añadido estilo para hover // add the css to the page var head = document head || document getelementsbytagname('head')\[0]; var style = document createelement('style'); head appendchild(style); style type = 'text/css'; if (style stylesheet) { style stylesheet csstext = css; } else { style appendchild(document createtextnode(css)); } // create the button and set its properties var button = document createelement('button'); button id = 'asisteclick button'; button innerhtml = text; button onclick = function() { window\ open(chatbot url, ' blank'); }; document body appendchild(button); // función para oscurecer el color en hover function shadecolor(color, percent) { var r = parseint(color substring(1,3),16); var g = parseint(color substring(3,5),16); var b = parseint(color substring(5,7),16); r = parseint(r (100 + percent) / 100); g = parseint(g (100 + percent) / 100); b = parseint(b (100 + percent) / 100); r = (r<255)?r 255; g = (g<255)?g 255; b = (b<255)?b 255; var rr = ((r tostring(16) length==1)?"0"+r tostring(16)\ r tostring(16)); var gg = ((g tostring(16) length==1)?"0"+g tostring(16)\ g tostring(16)); var bb = ((b tostring(16) length==1)?"0"+b tostring(16)\ b tostring(16)); return "#"+rr+gg+bb; }