我正在使用此网站上的魔术弹出窗口: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="example@domain.com" 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
你知道我哪里弄错了吗?
答案 0 :(得分:0)
删除&#34; JS&#34;来自
JS$(document).ready(function() {
应该是
$(document).ready(function() {
当您从Magnific网页复制它时,您的选择突出显示意外地抓住了&#34; JS&#34;从右上角。