How to make a floating Window Chat with any contact form embedded
Add this to the head of your website:
This code is a CDN library of font awesome icons (ver 6.4.2).
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
Next, you have to add the HTML code in a global element or place it on the page where you want it to be.
And the pace the shortcode of your form to the place where it says: [Add shortcode here]
<div class="pix-wrap"> <div class="pix-panel">Hi, welcome!<br />How can we assist you today?<br />[Add shortcode here]</div> <div class="pix-badge"> </div> </div>
Now, it’s time to style it as a floating chat box in the bottom right corner of the website.
Paste the code below in your global CSS file or the theme CSS (without the style tags):
.pix-wrap { z-index: 9999999; position: fixed; bottom: 40px; right: 40px; } .pix-badge { background: #0275ff; width: 60px; height: 60px; border-radius: 100%; box-shadow: 0px 3px 3px rgba(0,0,0,0.1); transition: all 0.1s ease-in-out; transform: scale(1.0); float: right; padding: 10px; } .pix-badge i { position: relative; left: 50%; transform: translate(-50% ,-50%); top: 50%; border: none!important; } .pix-badge:hover { transform: scale(1.1); cursor: pointer; } .pix-panel { width: 373px; /*Panel width*/ height: auto; /*Panel height*/ max-width: 400px; /*Mac Panel width*/ max-height: 800px; /*Max Panel height*/ background: #F9FAFA; box-shadow: 5px 5px 20px 0 rgba(0,0,0,0.10); position: absolute; bottom: 40px; right: 0px; transition: all 0.3s ease-in-out; opacity: 0; border-radius: 4px; overflow: hidden; padding:30px; border:1px solid #D9E0E3; } .panel-active { bottom: 80px; opacity: 100; } .gfield.no-label > .gfield_label { display: none; } .pix-panel input[type="submit"] { width:100% } .pix-icon{ color:#fff; font-size:25px; }
When this is done, we have to make it work. Let’s put the Java Script code in your global JS scrpit file or in the < head > of the website:
<script type="text/javascript"><br /> jQuery(document).ready(function( $ ){<br /> $('.pix-badge').click(function() {<br /> $('.pix-panel').toggleClass('panel-active');<br /> });<br /> });<br /> </script>
It’s all done!
Hi, welcome!
How can we assist you today?
0 Comments