I have a checkbox for an popup where I have to check it to save a cookie and make the popup not appear every time I change the page.
Here is my PopUp TWIG:
Liquid error: Unknown operator ajax
Here is my javascript file for the popup module:
// Popup Module
$('.module-popup').each(function () {
var $this = $(this);
var options = $.extend({
message: $this.html(),
timeout: 0
}, $this.data('options'));
var cookie = 'p-' + options['cookie'];
if (!Cookies.get(cookie)) {
setTimeout(function () {
$('html').addClass('popup-open popup-center');
$this.find('.popup-dont-show input[type="checkbox"]').on('change', function () {
if ($(this).is(':checked')) {
Cookies.set(cookie, '1', { expires: 1 });
} else {
Cookies.remove(cookie);
}
});
}, parseInt(options['showAfter'], 10) || 1);
}
});
$(document).delegate('.popup-close, .popup-bg-closable, .btn-popup:not([href])', 'click', function () {
$html.removeClass('popup-open popup-center');
if ($html.hasClass('iphone') || $html.hasClass('ipad')) {
iNoBounce.disable();
}
$('.popup-wrapper').attr('removing', true);
setTimeout(function () {
if ($('.popup-wrapper').attr('removing')) {
$('.popup-wrapper').remove();
}
}, 5000);
});
$(document).on('keydown', function (e) {
if (e.keyCode === 27) {
parent.$('.popup-bg-closable').trigger('click');
}
});
The idea is that if I change to or , the checkbox becomes checked but I press Enter and if I change the page it appears again. When the popup is appeared, with checkbox checked, if I uncheck and check again and press enter, it works...
What do I do wrong?
Aucun commentaire:
Enregistrer un commentaire