Created
March 27, 2014 12:54
-
-
Save thomasgriffin/9806920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
$(document).on('click', '.manual-optin-trigger', function(e){ | |
e.preventDefault(); | |
var $this = $(this); | |
// Ensure that the OptinMonster function exists. | |
if ( typeof window['OptinMonster'] === 'function' ) { | |
// Load a different optin based on ID. | |
if ( 'your-id-here' == $this.attr('id') ) { | |
// Append our holder to the DOM if it does not already exist. | |
if ( 0 === $('#om-' + om_manual_object.optin).length ) | |
$('<div id="om-' + om_manual_object.optin + '" />').appendTo('body'); | |
// Load OptinMonster. | |
var custom_optin_monster = new OptinMonster(); | |
custom_optin_monster.manualInit({ | |
optin: om_manual_object.optin, | |
ajax: om_manual_object.ajaxurl | |
}); | |
} else { | |
// Append our holder to the DOM if it does not already exist. | |
if ( 0 === $('#om-' + om_manual_object.optin2).length ) | |
$('<div id="om-' + om_manual_object.optin2 + '" />').appendTo('body'); | |
// Load OptinMonster. | |
var custom_optin_monster = new OptinMonster(); | |
custom_optin_monster.manualInit({ | |
optin: om_manual_object.optin2, | |
ajax: om_manual_object.ajaxurl | |
}); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment