我想在单个 HTML 页面中使用两个 Javascript 效果
- 滑块。
- 花哨的盒子。
当我在单个 HTML 页面中调用两个 JS 文件时,只有一个在工作。这是我的代码:
<head>
<!--other-->
<script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-replace.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_300.font.js"></script>
<script type="text/javascript" src="js/Myriad_Pro_400.font.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--other-->
<!--slider-->
<link rel="stylesheet" type="text/css" href="css/slider.css" media="screen" />
<script type="text/javascript" src="js/sliderjs/jquery.core.js"></script>
<script type="text/javascript" src="js/sliderjs/jquery.superfish.js"></script>
<script type="text/javascript" src="js/sliderjs/jquery.jcarousel.pack.js"></script>
<script type="text/javascript" src="js/sliderjs/jquery.easing.js"></script>
<script type="text/javascript" src="js/sliderjs/jquery.scripts.js"></script>
<!--slider-->
<!--Fancy Box-->
<!-- Add jQuery library -->
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="source/jquery.fancybox.js?v=2.1.0"></script>
<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css?v=2.1.0" media="screen" />
<!-- Add Button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="source/helpers/jquery.fancybox-buttons.css?v=1.0.3" />
<script type="text/javascript" src="source/helpers/jquery.fancybox-buttons.js?v=1.0.3"></script>
<script type="text/javascript">
$(document).ready(function() {
/*
* Button helper. Disable animations, hide close button, change title type and content
*/
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
}
});
/*
* Open manually
*/
$("#fancybox-manual-a").click(function() {
$.fancybox.open('images/gallary/1_b.jpg');
});
$("#fancybox-manual-b").click(function() {
$.fancybox.open({
href : 'iframe.html',
type : 'iframe',
padding : 5
});
});
$("#fancybox-manual-c").click(function() {
$.fancybox.open([
{
href : 'images/gallary/1_b.jpg',
title : 'My title'
}, {
href : 'images/gallary/2_b.jpg',
title : '2nd title'
}, {
href : 'images/gallary/3_b.jpg'
}
], {
helpers : {
thumbs : {
width: 75,
height: 50
}
}
});
});
});
</script>
</head>
这些都是JS。我认为 JQuery 1.8.min 与滑块冲突。当我阻止这个 JS 时,我的滑块正在工作,当我激活这个 JS 时,我的花哨的盒子不工作。