Skip to content

Instantly share code, notes, and snippets.

@ubsupport
ubsupport / modifying-validation-error-message.js
Created December 20, 2024 21:41
Modifying Unbounce Form Validation
<script>
// Change the message when a REQUIRED field is empty. Replace `ID_OF_FORM_FIELD` with your form field ID.
window.ub.form.validationMessages.ID_OF_FORM_FIELD.required = 'You forgot to enter your name!';
// Change the message when a field is invalid. Replace `ID_OF_FORM_FIELD` with your form field ID.
window.ub.form.validationMessages.ID_OF_FORM_FIELD.email = "That doesn't seem to be a valid email!";
// Change the message when a field is invalid. Replace `ID_OF_FORM_FIELD` with your form field ID.
window.ub.form.validationMessages.ID_OF_FORM_FIELD.phone = "That doesn't seem to be a valid phone number!";
@ubsupport
ubsupport / bullet-colour.css
Last active December 20, 2024 21:38
Changing Bullet Colour
<style>
.lp-pom-text ul, li {
color: ADD COLOR CODE HERE;
}
</style>
@ubsupport
ubsupport / bulletshape.css
Last active December 20, 2024 21:36
Changing Bullet Shape
<style>
.lp-pom-text ul, li {
list-style-type: square !important;
}
</style>
@ubsupport
ubsupport / ub-smooth-scroll.js
Created December 20, 2024 21:29
Unbounce Smooth Scrolling
<script>
jQuery($ => {
// The speed of the scroll in milliseconds
const speed = 1000;
$('a[href*="#"]')
.filter((i, a) => a.getAttribute('href').startsWith('#') || a.href.startsWith(`${location.href}#`))
.unbind('click.smoothScroll')
.bind('click.smoothScroll', event => {
const targetId = event.currentTarget.getAttribute('href').split('#')[1];
@ubsupport
ubsupport / unbounce-external-conversion-tracking-script.js
Created December 20, 2024 21:26
unbounce-external-conversion-tracking-script.js
<script type="text/javascript">
var _ubad = 'PAGE-DOMAIN-ON-UNBOUNCE';
var _ubaq = _ubaq || [];
_ubaq.push(['trackGoal']);
(function() {
var ub_script = document.createElement('script');
ub_script.type = 'text/javascript';
ub_script.src = '//' + _ubad + '/_ub/static/ets/t.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ub_script, s);
@ubsupport
ubsupport / ub-font-face.css
Created December 20, 2024 21:22
Bulletproof @font-face for Unbounce.html
<style>
/**
* Do not remove this section; it allows our team to troubleshoot and track feature adoption.
* TS:0001-07-008
*/
@font-face {
font-family: 'MyFontName';
src: url('//yoursite.com/fonts/myfont.eot?#iefix') format('embedded-opentype'),