Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var str = '\
- <style>\
- #cq-popup {\
- width: 700px;\
- height: 350px;\
- z-index: 23;\
- left: calc(50%);\
- top: calc(50%);\
- position: fixed!important;\
- padding: 60px 40px 60px 40px;\
- background-repeat: no-repeat; \
- background-position: right;\
- background-color: #fff;\
- font-family: Open Sans, sans-serif;\
- transform: translate(-50%, -50%) scale(1);\
- }\
- #cq-popup h3 {\
- font-size: 40px;\
- padding: 0;\
- width: 500px;\
- float: left;\
- text-align: left;\
- margin-bottom: 10px;\
- }\
- #cq-popup > div {\
- width: 500px;\
- font-size: 27px;\
- line-height: 36px;\
- }\
- #cq-popup-btclose {\
- text-decoration: none;\
- font-size: 29px;\
- position: absolute;\
- right: 10px;\
- top: 0px;\
- }\
- #cq-popup-bg {\
- cursor: pointer;\
- position: fixed;\
- top:0; \
- width: 100%; \
- height: 100%;\
- background: rgba(51,51,51,0.8);\
- z-index: 22;\
- }\
- </style>\
- <div id="cq-popup-bg"></div>\
- <div id="cq-popup">\
- <a id="cq-popup-btclose">×</a>\
- <h3>\
- Привет\
- </h3>\
- <div>Привет Мир!</div>\
- <a href="https://example.com" id="cq-link">Пример ссылки</a>
- <input id="cq-popup-js-input" type="email" placeholder="ВВЕДИТЕ ВАШ EMAIL">
- </div>\
- </div>\
- ';
- //Добавляем поп-ап на страницу
- var div = document.createElement('div');
- div.innerHTML = str;
- document.body.appendChild(div);
- //Записываем факт прочтения поп-апа. При этом в карточку пользователя уйдёт событие "Коммуникации: Прочитано сообщения"
- carrotquest.trackMessageInteraction('{{ sending_id }}', 'read');
- //Записываем факт ответа на поп-ап. Будем вызывать событие ответа после того, как пользователь увел фокус с поля
- document.getElementById(“cq-popup-js-input”).onblur = function() {
- carrotquest.trackMessageInteraction('{{ sending_id }}', 'replied');
- };
- //Записываем факт перехода по ссылке в поп-апе
- document.getElementById(“cq-link”).onclick = function() {
- carrotquest.trackMessageInteraction('{{ sending_id }}', clicked);
- };
- //Функция закрытия поп-ап по клику на кнопку
- document.getElementById('cq-popup-btclose').onclick = function () {
- document.getElementById('cq-popup-bg').remove();
- document.getElementById('cq-popup').remove();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement