2014-05-23 80 views
2

我有一個stackoverflow!magnificpopup「Maxium調用堆棧大小超過」

我已經追蹤了magnificpopup js文件的setFocus和onFocusIn的源代碼,但是我無法確定它在哪裏產生。

一些相關線路(在該片段的活性magnificpopup閉合並且一些JS(經由AJAX生成)創建另一個magnificpopup

var active_magnificPopup = $.magnificPopup.instance; 
$('#frm').ajaxSubmit({ url: '<?php echo get_template_directory_uri(); ?>/handleSubscriberForms.php', type: 'post', target: '#subscriptionSubmisionTarget' }); 
active_magnificPopup.close(); 

現在表單處理程序

jQuery(document).ready(function($) { 
    $("#ajax-thankyou").magnificPopup({ 
    type: "ajax", 
    alignTop: false, 
    closeOnContentClick: false, 
    overflowY: "scroll", // as we know that popup content is tall we set scroll overflow by default to avoid jump 
    tError: "<a href=\"%url%\">The content</a> could not be loaded." // Error message, can contain %curr% and %total% tags if gallery is enabled 
    }); 
    setTimeout(
    function() { 
     $("#ajax-thankyou").trigger("click"); 
    }, 
    125 
); 
}); 

的 '返回'據我所知,第一個彈出窗口在第二個彈出窗口出現之前是關閉的,但是,在移動設備中,代碼會生成一個計算器並且第一個彈出窗口不會關閉(第二個彈出窗口將在後面打開)。

如果有人能夠澄清這一點,這將是非常棒的......我的大腦在這一點上是痛苦的。

---後版潔的小費---

嘿潔,

的樣子,大概,來源是不是我想。我編輯了'返回',現在不使用觸發器(下一個代碼框)。這個東西像早期一樣工作(像電腦中的魅力,手機中的stakoverflow)。

echo ' 
    <script> 
     jQuery(document).ready(function($) { 
      setTimeout(
       function() { 
        $.magnificPopup.open({ 
         items: { 
          src: "' . get_template_directory_uri() . '/form-thankyou.php?pi=' . $post_ID . '" 
         }, 
         type: "ajax", 
         alignTop: false, 
         closeOnContentClick: false, 
         closeBtnInside: true, 
         overflowY: "scroll", 
         tError: "<a href=\"%url%\">The content</a> could not be loaded." 
        }); 
       }, 
       125 
      ); 
     }); 
    </script> 
'; 

這裏控制檯的日誌(其中據我所知,是o._setFocus和o._onFocusIn之間產生無限循環,但我想不出如何跟蹤哪些因素是產生它)

Uncaught RangeError: Maximum call stack size exceeded jquery.tools.min.js:37 
---From here to the end is repeating--- 
f.event.trigger jquery.tools.min.js:37 
(anonymous function) jquery.tools.min.js:37 
e.extend.each jquery.tools.min.js:36 
e.fn.e.each jquery.tools.min.js:36 
f.fn.extend.trigger jquery.tools.min.js:37 
f.fn.(anonymous function) jquery.tools.min.js:37 
e.fn.extend.focus jquery.ui.core.min.js?ver=1.10.4:4 
o._setFocus magnific-popup.min.js:3 
o._onFocusIn magnific-popup.min.js:3 
f.event.dispatch jquery.tools.min.js:37 
h.handle.i jquery.tools.min.js:37 

在此先感謝

回答

0

我也有同樣的問題,當我用.trigger()方法。解決方案,我做了什麼,我做了一個功能,並再次呼籲它,如果需要,所以你可以這樣做:

function magPopup(){ 
    $("#ajax-thankyou").magnificPopup({ 
    type: "ajax", 
    alignTop: false, 
    closeOnContentClick: false, 
    overflowY: "scroll", // as we know that popup content is tall we set scroll overflow by default to avoid jump 
    tError: "<a href=\"%url%\">The content</a> could not be loaded." // Error message, can contain %curr% and %total% tags if gallery is enabled 
    }); 
} 

jQuery(document).ready(function($) { 

    magPopup(); 

    setTimeout(function() { 
     magPopup(); 
    }, 125); 
}); 
+0

是行不通的。這將magnificpopup功能賦予項目'#ajax-thankyou'而不打開它,不是嗎? – jdev

相關問題