如何打开mailchimp popup onclick

时间:2017-10-20 11:52:44

标签: javascript jquery mailchimp

我试图在点击元素时打开我的mailchimp弹出窗口,但我什么也没看到。我跟着this answer,但它不适合我。当我点击我的元素时,我可以看到网络设置中发生了一些事情。当我单击该元素时控制日志显示的内容,因此js工作正常。那个问题/答案是2岁,所以也许在mailchimp方面有所改变?

我的代码:

我的元素:

<a style="width:100%;margin-top:20px;margin-bottom:20px;" href="javascript:void(0);" id="ctabutton" class="ctabutton ctabuttonmobiel open-popup kl-cta-ribbon" title="VRAAG EEN SCHERPE OFFERTE AAN"><strong>INSCHRIJVEN VOOR DE NIEUWSBRIEF</strong><svg version="1.1" class="trisvg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" preserveaspectratio="none" width="14px" height="5px" viewbox="0 0 14.017 5.006" enable-background="new 0 0 14.017 5.006" xml:space="preserve"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.016,0L7.008,5.006L0,0H14.016z"></path></svg></a>

我的js代码:

function showMailingPopUp() {
          require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us16.list-manage.com","uuid":"fab44298b45bd02e4d7427594","lid":"23ebf55005"})})
          document.cookie = "MCEvilPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
      };

      jQuery(function() {
          jQuery(".open-popup").on('click', function() {
              showMailingPopUp();
          });
      });

1 个答案:

答案 0 :(得分:0)

代替     document.cookie =“ MCEvilPopupClosed =; expires =星期四,1970年1月1日00:00:00 UTC”; 只需添加这两行来设置Cookie日期即可     document.cookie =“ MCPopupClosed =; path = /; expires = Thu,01 Jan 1970 00:00:00 UTC”;     document.cookie =“ MCPopupSubscribed =; path = /; expires = Thu,01 Jan 1970 00:00:00 UTC”;