Using the jquery cookie plugin I have a very simple function as so :
demoPopupInit: function() {
// alert($.cookie('modal-popup'));
if (! $.cookie('modal-popup')) {
$.cookie('modal-popup',1) ;
}
if ( $.cookie('modal-popup') <= 3 ) {
// return;
var modal_cookie = $.cookie('modal-popup') ;
modal_cookie = modal_cookie++;
$("#intro_index").modal({backdrop:true});
$.cookie('modal-popup', modal_cookie );
}
},
}
I am sure it is a very simple mistake, but my poor JS skills do not allow me to understand why the alert()
in the begining always turn 1
..
I also tried
if (! $.cookie('modal-popup') == NULL) {
$.cookie('modal-popup',1) ;
But of course ,the problem is not there , and no other error reported in console. My aim is to turn the modal pop-up on only on 3 first visits .