| 1 |
/* jshint asi: true */ |
| 2 |
jQuery(document).ready( function($) { |
| 3 |
$( document ).on( 'click', '[data-optin-cat]', function( e ) { |
| 4 |
e.preventDefault() |
| 5 |
var id = $( this ).data( 'optin-cat' ) |
| 6 |
add_impression( id ) |
| 7 |
var $lightbox = $( '#fca_eoi_lightbox_' + id ) |
| 8 |
$.featherlight( $lightbox, { variant: 'fca_eoi_featherlight', closeOnClick: false, afterOpen: function(){ |
| 9 |
var $instance = this.$instance |
| 10 |
if ( $lightbox.hasClass('animated') ) { |
| 11 |
setTimeout( function(){ |
| 12 |
$instance.find('span.featherlight-close-icon.featherlight-close').show() |
| 13 |
$instance.find('.fca_eoi_form_input_element').last().focus() |
| 14 |
}, 600) |
| 15 |
} else { |
| 16 |
$instance.find('span.featherlight-close-icon.featherlight-close').show() |
| 17 |
$instance.find('.fca_eoi_form_input_element:visible').first().focus() |
| 18 |
} |
| 19 |
}}) |
| 20 |
}) |
| 21 |
|
| 22 |
function add_impression( id ) { |
| 23 |
$.ajax({ |
| 24 |
url: fcaEoiScriptData.ajax_url, |
| 25 |
type: 'POST', |
| 26 |
data: { |
| 27 |
nonce: fcaEoiScriptData.nonce, |
| 28 |
form_id: id, |
| 29 |
action: 'fca_eoi_activity' |
| 30 |
} |
| 31 |
}) |
| 32 |
} |
| 33 |
|
| 34 |
}) |
| 35 |
|
| 36 |
|