我启动了一个包含颜色框插件的网页。它确实起作用,但是,当我添加ui元素(选项卡)时,我的插件似乎无法正常工作。返回错误$(...)。tabs不是函数。仅当我试图使两者都起作用时,此错误才会出现。当我删除选项卡的代码时,插件可以正常工作。有任何想法吗?
<link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="proppagesstyle.css">
<link rel="stylesheet" href="colorbox\colorbox-master\colorbox.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="colorbox\colorbox-master\jquery.colorbox.js"></script>
<div id="tabs-1">
<ul>
<li><a href="#tabs-2">Description</a></li>
<li><a href="#tabs-3">Floor Plan</a></li>
<li><a href="#tabs-4">Map</a></li>
</ul>
<div id="tabs-2">
<p>
Description
</p>
</div>
<div id="tabs-3">
<p>
<img src="prop1Plan.jpg">
</p>
</div>
<div id="tabs-4">
<p>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d39851.09199225635!2d0.061092186988258655!3d51.371935680859664!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47d8ab091574bbd7%3A0x12eb74ad89922e5b!2sOrpington!5e0!3m2!1sen!2suk!4v1482163876019" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
</p>
</div>
</div>
<script>
$(document).ready(function () {
$(".group1").colorbox({ rel: 'gallery' });
});
$("#click").click(function () {
$('#click').css({ "background-color": "#f00", "color": "#fff", "cursor": "inherit" }).text("Open this window again and this message will still be here.");
return false;
});
$(function () {
"use strict";
$("#tabs-1").tabs();
});
</script>
问题是因为您要在第一个版本之后添加第二个版本的jQuery。这将覆盖之前jQuery
已应用jQueryUI方法的实例。
要解决该问题,只需删除对jQuery的第二个引用1.10.2
。页面中仅包含一个版本的jQuery。
<link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<link rel="stylesheet" href="colorbox\colorbox-master\colorbox.css" />
<link rel="stylesheet" type="text/css" href="proppagesstyle.css">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script src="colorbox\colorbox-master\jquery.colorbox.js"></script>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句