我启动了一个包含彩盒插件的网页。它确实有效,但是,当我添加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>
答案 0 :(得分:1)
问题是因为您在第一个版本之后添加了第二个版本的jQuery。这会覆盖之前应用了jQueryUI方法的jQuery
实例。
要解决此问题,只需删除对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>