Advertisement
ivan_carrotquest

Untitled

Apr 26th, 2017
2,483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. var str = '\
  2. <style>\
  3. #cq-popup {\
  4. width: 700px;\
  5. height: 350px;\
  6. z-index: 23;\
  7. left: calc(50%);\
  8. top: calc(50%);\
  9. position: fixed!important;\
  10. padding: 60px 40px 60px 40px;\
  11. background-repeat: no-repeat; \
  12. background-position: right;\
  13. background-color: #fff;\
  14. font-family: Open Sans, sans-serif;\
  15. transform: translate(-50%, -50%) scale(1);\
  16. }\
  17. #cq-popup h3 {\
  18. font-size: 40px;\
  19. padding: 0;\
  20. width: 500px;\
  21. float: left;\
  22. text-align: left;\
  23. margin-bottom: 10px;\
  24. }\
  25. #cq-popup > div {\
  26. width: 500px;\
  27. font-size: 27px;\
  28. line-height: 36px;\
  29. }\
  30. #cq-popup-btclose {\
  31. text-decoration: none;\
  32. font-size: 29px;\
  33. position: absolute;\
  34. right: 10px;\
  35. top: 0px;\
  36. }\
  37. #cq-popup-bg {\
  38. cursor: pointer;\
  39. position: fixed;\
  40. top:0; \
  41. width: 100%; \
  42. height: 100%;\
  43. background: rgba(51,51,51,0.8);\
  44. z-index: 22;\
  45. }\
  46. </style>\
  47. <div id="cq-popup-bg"></div>\
  48. <div id="cq-popup">\
  49. <a id="cq-popup-btclose">×</a>\
  50. <h3>\
  51. Привет\
  52. </h3>\
  53. <div>Привет Мир!</div>\
  54. <a href="https://example.com" id="cq-link">Пример ссылки</a>
  55. <input id="cq-popup-js-input" type="email" placeholder="ВВЕДИТЕ ВАШ EMAIL">
  56. </div>\
  57. </div>\
  58. ';
  59.  
  60. //Добавляем поп-ап на страницу
  61. var div = document.createElement('div');
  62. div.innerHTML = str;
  63. document.body.appendChild(div);
  64.  
  65. //Записываем факт прочтения поп-апа. При этом в карточку пользователя уйдёт событие "Коммуникации: Прочитано сообщения"
  66. carrotquest.trackMessageInteraction('{{ sending_id }}', 'read');
  67.  
  68. //Записываем факт ответа на поп-ап. Будем вызывать событие ответа после того, как пользователь увел фокус с поля
  69. document.getElementById(“cq-popup-js-input”).onblur = function() {
  70. carrotquest.trackMessageInteraction('{{ sending_id }}', 'replied');
  71. };
  72.  
  73. //Записываем факт перехода по ссылке в поп-апе
  74. document.getElementById(“cq-link”).onclick = function() {
  75. carrotquest.trackMessageInteraction('{{ sending_id }}', clicked);
  76. };
  77.  
  78. //Функция закрытия поп-ап по клику на кнопку
  79. document.getElementById('cq-popup-btclose').onclick = function () {
  80. document.getElementById('cq-popup-bg').remove();
  81. document.getElementById('cq-popup').remove();
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement