Skip to content

Instantly share code, notes, and snippets.

@noahub
Last active August 27, 2019 17:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahub/ee480189a99aeac35d6005ce57a2aa3a to your computer and use it in GitHub Desktop.
Save noahub/ee480189a99aeac35d6005ce57a2aa3a to your computer and use it in GitHub Desktop.
Conversational Forms in Unbounce
<style>
.lp-pom-form, .lp-pom-form.lp-pom-button{
visibility:hidden;
}
/*some sample styling*/
/* .conversational-form cf-chat-response.robot text {
font-size: 14px;
}
.conversational-form cf-chat-response.user text {
font-size: 14px;
}
.conversational-form cf-chat-response.robot {
max-width: 85%;
}
.conversational-form cf-input input{
font-size: 120%;
}
.conversational-form cf-button {
font-size: 14px;
}
cf-chat-response{
color: #444 !important;
}*/
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://conversational-form-0iznjsw.stackpathdns.com/conversational-form.min.js" crossorigin></script>
<script>
$("name").attr("pattern", "/^$|\s+/");
var formElm = document.getElementsByClassName("lp-pom-form")[0];
var context = $(formElm).parent()[0];
$(formElm).conversationalForm({
context: context,
submitCallback: (e) => {
window.ConversationalForm.addRobotChatResponse("Awesome. Thanks for your time!"); //update with final message
lp.jQuery('.lp-pom-form form').submit();
},
robotImage: "http://unbounce.wpengine.netdna-cdn.com/photos/Unbounce-icon-light-background.png",
userImage: "https://commons.wikimedia.org/wiki/File%3ASolid_white.png"
});
/**
* Do not remove this section; it allows our team to troubleshoot and track feature adoption.
* TS:0002-03-066
*/
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment