forked from LiveCarta/LiveCartaWP
LAW-3822
This commit is contained in:
34
htdocs/wp-content/themes/lawcarta/assets/js/promoPopup.js
Normal file
34
htdocs/wp-content/themes/lawcarta/assets/js/promoPopup.js
Normal file
@@ -0,0 +1,34 @@
|
||||
(function(){
|
||||
|
||||
// if (document.querySelector('.show-promo-popup')) {
|
||||
// alert(1);
|
||||
// }
|
||||
|
||||
function addPopup(){
|
||||
var popup = '<div class="promo-popup">' +
|
||||
'<a href="#" class="pp-close"><span class="icon-close"></span></a>' +
|
||||
'<div class="pp-text">Sign up to Learn How to Get Your Book Published!</div>' +
|
||||
'<div class="pp-btn"><a href="/user/registration" class="button mp-top-left xxl">sign up for free</a></div>' +
|
||||
'</div>';
|
||||
|
||||
document.body.insertAdjacentHTML('beforeend', popup);
|
||||
setTimeout(function(){
|
||||
document.querySelector('.promo-popup').classList.add('show');
|
||||
document.querySelector('.promo-popup .pp-close').addEventListener('click', function(e){
|
||||
e.preventDefault();
|
||||
var popup = document.querySelector('.promo-popup');
|
||||
popup.parentElement.removeChild(popup);
|
||||
})
|
||||
},500);
|
||||
}
|
||||
|
||||
if (document.querySelector('.show-promo-popup')) {
|
||||
setTimeout(function(){
|
||||
if (document.querySelector('a[href*="user/login"]')) {
|
||||
addPopup();
|
||||
}
|
||||
}, 6000);
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user