Skip to content

Instantly share code, notes, and snippets.

<script>
$( '.lp-pom-form .lp-pom-button' ).click(function() {
if (lp.jQuery('form').valid() == true) {
_gaq.push(['_trackEvent', 'form', 'button', 'submit']);
}
});
</script>
@GaryUnbounce
GaryUnbounce / KISSMetrics
Created February 18, 2014 22:58
Add KISSMetrics event tracking
<script type="text/javascript">
var getUrlParams = function () {
var params = {},
hash;
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0]] = unescape(hash[1]);
}
return params;
@GaryUnbounce
GaryUnbounce / ReferrerData
Last active August 29, 2015 13:56
Capture referrer data
<script type="text/javascript">
jQuery(function(){
jQuery('input#referrer').val(decodeURI(document.referrer));
});
</script>
@GaryUnbounce
GaryUnbounce / NoUnderline
Created February 18, 2014 22:49
Remove the underline from text links
<style type="text/css">
#lp-pom-root .lp-pom-text a:link {text-decoration: none}
#lp-pom-root .lp-pom-text a:visited {text-decoration: none}
#lp-pom-root .lp-pom-text a:active {text-decoration: none}
#lp-pom-root .lp-pom-text a:hover {text-decoration: none}
</style>
@GaryUnbounce
GaryUnbounce / FancyBox_web
Last active August 29, 2015 13:56
Button link to open a lightbox (iframe) webpage
<script>
$(document).ready(function() {
$('#lp-pom-button-22').fancybox({
type: 'iframe',
width: 840,
height: 480
});
});
</script>
@GaryUnbounce
GaryUnbounce / FullBackgorund
Created February 18, 2014 22:41
Make a background image scale the full page
<style type="text/css">
#lp-pom-root {
-webkit-background-size: cover !important;
-moz-background-size: cover !important;
-o-background-size: cover !important;
background-size: cover !important;
}
</style>
@GaryUnbounce
GaryUnbounce / SmoothScroll_Anchor
Created February 18, 2014 22:40
Create smooth scrolling anchor links
<script>
$(document).ready(function(){
$(".scroll").click(function(event){
//prevent the default action for the click event
event.preventDefault();
//get the full url - like mysitecom/index.htm#home
var full_url = this.href;
@GaryUnbounce
GaryUnbounce / Focus_FirstField
Created February 18, 2014 22:31
Automatically focus the first field of a form
<script type="text/javascript">
jQuery(function() {
jQuery('form input:text:visible:first').focus();
});
</script>
@GaryUnbounce
GaryUnbounce / FancyBox_Images
Created February 18, 2014 22:29
Add a lightbox style window for image previews
<script type="text/javascript">
jQuery(function() {
jQuery(".lp-pom-image a[target='_self']").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'fade',
'overlayOpacity' : 0.8,
'overlayColor' : '#000',
'hideOnContentClick' : true
});
});
@GaryUnbounce
GaryUnbounce / SmoothScroll
Created February 18, 2014 22:27
Add Smooth Scrolling Button Links
<script>
$(document).ready(function(){
$("[#lp-pom-button-21").click(function(event){
event.preventDefault();
$('html, body').animate({ scrollTop: $("#form").offset().top }, 1000);
});
});
</script>