2014-02-28 130 views
0

雖然我使用本網站magicnific彈出:http://dimsemenov.com/plugins/magnific-popup/

這是我的代碼:

<head> 
    <link href="Scripts/magnific-popup.css" rel="stylesheet" type="text/css" /> 
<script> 
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'; 
      } 
     } 
    } 
}); 
    }); 
    </script> 
    </head> 

這是我的身體:

<body> 
    HTML<!-- link that opens popup --> 
<a class="popup-with-form" href="#test-form">Open form</a> 

<!-- form itself --> 
    <form id="test-form" class="mfp-hide white-popup-block"> 
<h1>Form</h1> 
<fieldset style="border: 0px currentColor;"> 

    <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> 
<script src="Scripts/jquery-1.11.0.min.js" type="text/javascript"></script> 


<script src="Scripts/jquery.magnific-popup.js" type="text/javascript"></script> 


    </body> 

我有一個腳本文件夾下我的項目的根目錄包含這些文件:

jquery-1.11.0.min.js 
jquery.magnific-popup.js 
jquery.magnific-popup.min.js 
magnific-popup.css 

當我運行我得到這個錯誤的項目:

Microsoft JScript runtime error: 'JS$' is undefined 

你知道我錯了嗎?從

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

回答

0

刪除 「JS」 這應該是

$(document).ready(function() { 

當你Magnific酒店從網頁上覆制它,您的選擇彰顯無意中抓住 「JS」,從右上角。

相關問題