2014-02-14 44 views
1

我已经加载了magnifica popup.js库来显示窗体的弹出窗口。无法打开使用JQuery和弹出popup popup的弹出窗口

HTML:

<a class="popup-with-form" href="#test-form">Open form</a> 

<form id="test-form" class="mfp-hide white-popup-block"> 
     <h1>Form</h1> 

    <fieldset style="border:0;"> 
     <p>Lightbox has an option to automatically focus on the first input. It's strongly recommended to use <code>inline</code> popup type for lightboxes with form instead of <code>ajax</code> (to keep entered data if the user accidentally refreshed the page).</p> 
     <ol> 
      <li> 
       <label for="name">Name</label> 
       <input id="name" name="name" type="text" placeholder="Name" required=""> 
      </li> 
      <li> 
       <label for="email">Email</label> 
       <input id="email" name="email" type="email" placeholder="[email protected]" required=""> 
      </li> 
      <li> 
       <label for="phone">Phone</label> 
       <input id="phone" name="phone" type="tel" placeholder="Eg. +447500000000" required=""> 
      </li> 
      <li> 
       <label for="textarea">Textarea</label> 
       <br> 
       <textarea id="textarea">Try to resize me to see how popup CSS-based resizing works.</textarea> 
      </li> 
     </ol> 
    </fieldset> 
</form> 

JS:

$(document).ready(function() { 
    $('.popup-with-form').magnificPopup({ 
     type: 'inline', 
     preloader: false, 
     focus: '#name', 

     // When elemened is focused, some mobile browsers in some cases zoom in 
     // It looks not nice, so we disable it: 
     callbacks: { 
      beforeOpen: function() { 
       if ($(window).width() < 700) { 
        this.st.focus = false; 
       } else { 
        this.st.focus = '#name'; 
       } 
      } 
     } 
    }); 
}); 

在弹出这是不显示的形式如预期。您可能会看到具有相关性的示例here

+0

弹出的FF为我打开并显示形式。它需要清理一些,但除了它的工作。您是否在浏览器中查看了您正在测试的错误的控制台? –

+0

我在控制台中没有收到错误/消息。 Chrome中的弹出窗口只是一个空白屏幕,输入字段 –

回答

相关问题