我在一个页面上使用两个不同的脚本,当我同时调用它们时,其中一个不起作用。如果我删除一个,那么剩下的一个工作。为什么他们都不工作?以下是我在页面头部的内容:
<script type="text/javascript" src="jscript/jquery.js"></script>
<script type="text/javascript" src="jscript/script.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="../plugins/nicescroll/jquery.nicescroll.min.js"></script>
<script>
$(document).ready(function () {
var nice = $("html").niceScroll();
$("#outer").html($("#outer").html());
$(".overflow").niceScroll({
cursorborder: "",
cursorcolor: "#333333",
boxzoom: false,
cursorwidth: "5px"
});
});
</script>
<script type="text/javascript" src="tabslider/javascripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="tabslider/javascripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="tabslider/javascripts/jquery.coda-slider-2.0.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#coda-slider-1').codaSlider();
});
</script>
答案 0 :(得分:4)
您的脚本应如下所示:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="jscript/script.js"></script>
<script type="text/javascript" src="../plugins/nicescroll/jquery.nicescroll.min.js"></script>
<script type="text/javascript" src="tabslider/javascripts/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="tabslider/javascripts/jquery.coda-slider-2.0.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var nice = $("html").niceScroll();
$("#outer").html($("#outer").html());
$(".overflow").niceScroll({cursorborder:"",cursorcolor:"#333333",boxzoom:false,cursorwidth:"5px"});
$('#coda-slider-1').codaSlider();
});
</script>
问题是你正在加载3个jQuery版本,而其他脚本的顺序不正确