/* global ajaxurl, wp2sv_url*/ window.wp2sv=window.wp2sv||{}; (function(wp2sv,$){ "use strict"; var openedModal; var opening=0; var zIndex=9999; wp2sv.init=function(){ $(document).on('click','[data-wp2sv-modal]',function(e){ e.preventDefault(); wp2sv.openModal($(this).data('wp2sv-modal')); }); $(document).on('click','.wp2sv-modal-close',function(e){ e.preventDefault(); wp2sv.closeModal(this); }) }; wp2sv.openModal=function(modal){ modal=$(modal).closest('.wp2sv-modal'); if(!modal.find('.wp2sv-modal-content').length){ modal.wrapInner('
'); //console.log(modal); } modal.trigger('open'); $(document).trigger('wp2sv-modal-open'); if(!modal.find('.wp2sv-modal-close-icon').length){ modal.append('