Skip to content

Commit 039836a

Browse files
author
Asa Schachar
committed
Add color and font customization to exit intent modal
1 parent 9afea10 commit 039836a

File tree

2 files changed

+65
-7
lines changed

2 files changed

+65
-7
lines changed

Extensions/Editor Extensions/Exit Intent Pop-up/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ When a user moves the mouse off screen a pop-up will appear.
88

99
## Fields
1010

11-
* Pop-up headline text
11+
* Headline
1212
* Secondary text
1313
* Link
1414
* Link text
15+
* Modal Overlay Color
16+
* Modal Color
17+
* Headline Color
18+
* Secondary Text Color
19+
* Button Color
20+
* Font Family
1521

Extensions/Editor Extensions/Exit Intent Pop-up/config.json

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"edit_page_url": "http://www.atticandbutton.us",
55
"form_schema": [
66
{
7-
"default_value": "Don't go!",
7+
"default_value": "Don't go yet!",
88
"field_type": "text",
99
"name": "headline",
1010
"label": "Headline",
1111
"options": null
1212
},
1313
{
14-
"default_value": "Stick around and buy some stuff",
14+
"default_value": "Stick around and buy some stuff!",
1515
"field_type": "text",
1616
"name": "secondary",
1717
"label": "Secondary Text",
@@ -25,18 +25,70 @@
2525
"options": null
2626
},
2727
{
28-
"default_value": "Please stay!",
28+
"default_value": "RSVP YES",
2929
"field_type": "text",
3030
"name": "link_text",
3131
"label": "Link Text",
3232
"options": null
33+
},
34+
{
35+
"default_value": "rgba(229, 27, 233, 0)",
36+
"field_type": "color",
37+
"name": "overlay_color",
38+
"label": "Modal Overlay Color",
39+
"options": {
40+
"mode": "rgba"
41+
}
42+
},
43+
{
44+
"default_value": "rgba(255, 255, 255, 1)",
45+
"field_type": "color",
46+
"name": "modal_color",
47+
"label": "Modal Color",
48+
"options": {
49+
"mode": "rgba"
50+
}
51+
},
52+
{
53+
"default_value": "rgba(0, 0, 0, 1)",
54+
"field_type": "color",
55+
"name": "headline_color",
56+
"label": "Headline Color",
57+
"options": {
58+
"mode": "rgba"
59+
}
60+
},
61+
{
62+
"default_value": "rgba(255, 255, 255, 1)",
63+
"field_type": "color",
64+
"name": "secondary_color",
65+
"label": "Secondary Text Color",
66+
"options": {
67+
"mode": "rgba"
68+
}
69+
},
70+
{
71+
"default_value": "rgba(0, 0, 0, 1)",
72+
"field_type": "color",
73+
"name": "button_color",
74+
"label": "Button Color",
75+
"options": {
76+
"mode": "rgba"
77+
}
78+
},
79+
{
80+
"default_value": "Graphik, Lato, Helvetica, Verdana, sans-serif",
81+
"field_type": "text",
82+
"name": "modal_font",
83+
"label": "Font Family",
84+
"options": null
3385
}
3486
],
35-
"description": "If the user tries to leave the window, a popup will show begging them not to leave. ",
87+
"description": "If the user tries to leave the window, a popup will show asking them not to leave. ",
3688
"options": {
37-
"html": "<div class=\"exit-intent-modal\">\n <div id=\"exit-popup-overlay\"></div>\n <div id=\"exit-popup-wrapper\">\n <div id=\"exit-popup\">\n <div id=\"exit-popup-close\" class=\"exit-popup-close\">x</div>\n <h2>{{widget.headline}}</h2>\n <p>{{widget.secondary}}</p>\n <a href=\"{{widget.link}}\" class=\"btn exit-popup-close\">{{widget.link_text}}</a>\n </div>\n </div>\n</div>",
38-
"css": ".exit-intent-modal{\n\topacity: 0;\n position: fixed;\n z-index: 3001;\n width: 100%;\n text-align: center;\n\theight: 100% !important;\n}\n\nbody {\n height: 100%;\n float: left;\n position: relative;\n}\n\n#exit-popup-overlay {\n height: 100vh !important;\n z-index: 3000;\n position: fixed;\n width: 100%;\n background: #000;\n opacity: 0.5;\n}\n#exit-popup-wrapper {\n margin: 50px 0;\n position: fixed;\n z-index: 3001;\n width: 100%;\n height: 100vh;\n text-align: center;\n}\n\n#exit-popup {\n width: 500px;\n display: inline-block;\n background: #fff;\n padding: 50px 20px;\n position: relative;\n}\n\n#exit-popup h2 {\n margin-top: 20px;\n}\n\n#exit-popup p {\n \n}\n#exit-popup-close {\n top: 10px;\n right: 20px;\n font-size: 20px;\n position: absolute;\n font-weight: bold;\n cursor: pointer;\n font-family: \"helvetica\", \"arial\", \"sans-serif\";\n}\n#exit-popup-close:hover {\n color: #999;\n}\n\n.fade-in {\n -webkit-animation: fadein .5s; /* Safari, Chrome and Opera > 12.1 */\n -moz-animation: fadein .5s; /* Firefox < 16 */\n -ms-animation: fadein .5s; /* Internet Explorer */\n -o-animation: fadein .5s; /* Opera < 12.1 */\n animation: fadein .5s;\n opacity: 1 !important;\n}\n\n.fade-out {\n -webkit-animation: fadeout 1s; /* Safari, Chrome and Opera > 12.1 */\n -moz-animation: fadeout 1s; /* Firefox < 16 */\n -ms-animation: fadeout 1s; /* Internet Explorer */\n -o-animation: fadeout 1s; /* Opera < 12.1 */\n animation: fadeout 1s;\n opacity: 0 !important;\n}\n\n@keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Firefox < 16 */\n@-moz-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Safari, Chrome and Opera > 12.1 */\n@-webkit-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Internet Explorer */\n@-ms-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Opera < 12.1 */\n@-o-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Firefox < 16 */\n@-moz-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Safari, Chrome and Opera > 12.1*/\n@-webkit-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Internet Explorer*/\n@-ms-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Opera < 12.1*/\n@-o-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n",
3989
"apply_js": "var utils = window.optimizely.get('utils');\n\nutils.waitForElement('body').then(function(element){\n\tvar html = widget.$html;\n element.insertAdjacentHTML('afterbegin', html);\n element.addEventListener('mouseleave', function(){\n showPopup();\n\t\tbindCloseBtn();\n });\n});\n\nfunction showPopup() {\n if(document.querySelector('.fade-out')){\n\t document.querySelector('.fade-out').classList.remove('fade-out');\n }\n document.querySelector('.exit-intent-modal').classList += ' fade-in';\n}\n\nfunction hidePopup() {\n document.querySelector('.exit-intent-modal').classList += ' fade-out';\n}\n\nfunction bindCloseBtn() {\n\tdocument.querySelector('.exit-popup-close').addEventListener('click', function(e){\n hidePopup();\n });\n}",
90+
"html": "<div class=\"exit-intent-modal\" style=\"background-color: {{extension.overlay_color}}; font-family: {{extension.modal_font}}\">\n <div id=\"exit-popup-overlay\"></div>\n <div id=\"exit-popup-wrapper\">\n <div id=\"exit-popup\" style=\"background-color: {{extension.modal_color}}\">\n <div id=\"exit-popup-close\" class=\"exit-popup-close\">x</div>\n <h2 style=\"color: {{extension.headline_color}}; font-family: {{extension.modal_font}}\">{{widget.headline}}</h2>\n <p style=\"color: {{extension.secondary_color}; font-family: {{extension.modal_font}}}\">{{widget.secondary}}</p>\n <a href=\"{{widget.link}}\" class=\"btn exit-popup-close\" style=\"background-color: {{extension.button_color}}; font-family: {{extension.modal_font}}\">{{widget.link_text}}</a>\n </div>\n </div>\n</div>",
91+
"css": ".exit-intent-modal{\n\topacity: 0;\n position: fixed;\n z-index: 3001;\n width: 100%;\n text-align: center;\n\theight: 100% !important;\n}\n\nbody {\n height: 100%;\n float: left;\n position: relative;\n}\n\n#exit-popup-overlay {\n height: 100vh !important;\n z-index: 3000;\n position: fixed;\n width: 100%;\n background: #000;\n opacity: 0.5;\n}\n#exit-popup-wrapper {\n margin: 50px 0;\n position: fixed;\n z-index: 3001;\n width: 100%;\n height: 100vh;\n text-align: center;\n}\n\n#exit-popup {\n width: 500px;\n display: inline-block;\n background: #fff;\n padding: 50px 20px;\n position: relative;\n}\n\n#exit-popup h2 {\n margin-top: 20px;\n}\n\n#exit-popup p {\n \n}\n#exit-popup-close {\n top: 10px;\n right: 20px;\n font-size: 20px;\n position: absolute;\n font-weight: bold;\n cursor: pointer;\n}\n#exit-popup-close:hover {\n color: #999;\n}\n\n.fade-in {\n -webkit-animation: fadein .5s; /* Safari, Chrome and Opera > 12.1 */\n -moz-animation: fadein .5s; /* Firefox < 16 */\n -ms-animation: fadein .5s; /* Internet Explorer */\n -o-animation: fadein .5s; /* Opera < 12.1 */\n animation: fadein .5s;\n opacity: 1 !important;\n}\n\n.fade-out {\n -webkit-animation: fadeout 1s; /* Safari, Chrome and Opera > 12.1 */\n -moz-animation: fadeout 1s; /* Firefox < 16 */\n -ms-animation: fadeout 1s; /* Internet Explorer */\n -o-animation: fadeout 1s; /* Opera < 12.1 */\n animation: fadeout 1s;\n opacity: 0 !important;\n}\n\n@keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Firefox < 16 */\n@-moz-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Safari, Chrome and Opera > 12.1 */\n@-webkit-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Internet Explorer */\n@-ms-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n/* Opera < 12.1 */\n@-o-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n@keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Firefox < 16 */\n@-moz-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Safari, Chrome and Opera > 12.1*/\n@-webkit-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Internet Explorer*/\n@-ms-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* Opera < 12.1*/\n@-o-keyframes fadeout {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n",
4092
"undo_js": "var extensionHTML = document.querySelector('.exit-intent-modal');\nif (extensionHTML) extensionHTML.remove();"
4193
}
4294
}

0 commit comments

Comments
 (0)