Skip to content

Instantly share code, notes, and snippets.

@noahmanion
Created February 5, 2016 17:49
Show Gist options
  • Save noahmanion/4dfe230ba027137eb1bb to your computer and use it in GitHub Desktop.
Save noahmanion/4dfe230ba027137eb1bb to your computer and use it in GitHub Desktop.
<script>
function detectmob() {
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){ return true
} else {
return false
};
}
if ( detectmob() ) {
setTimeout(function() {
$('#ouibounce-modal').modal('show');
},2000);
} else {
// if you want to use the 'fire' or 'disable' fn,
// you need to save OuiBounce to an object
var _ouibounce = ouibounce(document.getElementById('ouibounce-modal'), {
aggressive: true,
timer: 0,
callback: function() { console.log('ouibounce fired!'); }
});
$('body').on('click', function() {
$('#ouibounce-modal').hide();
});
$('#ouibounce-modal .modal-footer').on('click', function() {
$('#ouibounce-modal').hide();
});
$('#ouibounce-modal .modal').on('click', function(e) {
e.stopPropagation();
});
function goHome() {
locaiton.href = 'https://sagegreenlife.com';
}
$('#ouibounce-modal #mc_embed_singup .button').on('click', setTimeout(goHome(), 5000));
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment