I have written the following jQuery code to show a popup when user reaches the end of page. For some reason its giving me error:

throw er;

Code:

 jQuery(document).ready(function(){
    jQuery('#popup-container a.close').click(function(){
      jQuery('#popup-container').fadeOut();
      jQuery('#active-popup').fadeOut();
    });

    var visits = jQuery.cookie('visits') || 0;
    visits++;

    jQuery.cookie('visits', visits, { expires: 1, path: '/' });

    console.debug(jQuery.cookie('visits'));
    jQuery(window).scroll(function() {
      if (jQuery(window).scrollTop() + jQuery(window).height() === jQuery(document).height()) {
        if (jQuery.cookie('visits') > 1) {
          jQuery('#active-popup').hide();
          jQuery('#popup-container').hide();
        } else {
          var pageHeight = jQuery(document).height();
          jQuery('<div id="active-popup"></div>').insertBefore('body');
          jQuery('#active-popup').css("height", pageHeight);
          jQuery('#popup-container').show();
        }
      }
    }
    if (jQuery.cookie('noShowWelcome')) { jQuery('#popup-container').hide(); jQuery('#active-popup').hide(); }
  });

Read more here: throw er; error in jQuery code – WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: