我有一个页面有3个脚本:idTabs,灯箱(来自Dreamweaver)和手风琴(也来自Dreamweaver)。我做了一些测试:灯箱不适合手风琴。他们中的每一个人都能正常工作,但是手风琴联合出现故障,不起作用和灯箱工作。 这里是一些代码:lightbox手风琴冲突
<link href="style.css" rel="stylesheet" type="text/css" media="screen"> <script type="text/javascript" src="jquery.idTabs.min.js"></script> <script src="jquery-ui-1.7.2/js/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="jquery-ui-1.7.2/js/jquery-ui-1.7.2.min.js" type="text/javascript> </script> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/lightbox.js" type="text/javascript"></script> <link href="jquery-ui-1.7.2/css/base/ui.core.css" rel="stylesheet" type="text/css" /> <link href="jquery-ui-1.7.2/css/base/ui.accordion.css" rel="stylesheet" type="text/css" /> <link href="jquery-ui-1.7.2/css/base/ui.theme.css" rel="stylesheet" type="text/css" /> <link href="jquery-ui-1.7.2/css/base/ui.images.css" rel="stylesheet" type="text/css" /> <script type="text/xml"> <!-- <oa:widgets> <oa:widget wid="2028523" binding="#jQueryUIAccordion" /> <oa:widget wid="2127022" binding="#gallery" /> </oa:widgets> --> </script> <link href="css/lightbox.css" rel="stylesheet" type="text/css" /> <link href="css/sample_lightbox_layout.css" rel="stylesheet" type="text/css" />
这是在<head>
这是收藏
<script type="text/javascript">
// BeginOAWidget_Instance_2127022: #gallery
$(function(){
$('#gallery a').lightBox({
imageLoading: '/images/lightbox/lightbox-ico-loading.gif', // (string) Path and the name of the loading icon
imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif', // (string) Path and the name of the prev button image
imageBtnNext: '/images/lightbox/lightbox-btn-next.gif', // (string) Path and the name of the next button image
imageBtnClose: '/images/lightbox/lightbox-btn-close.gif', // (string) Path and the name of the close btn
imageBlank: '/images/lightbox/lightbox-blank.gif', // (string) Path and the name of a blank image (one pixel)
fixedNavigation: false, // (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
containerResizeSpeed: 400, // Specify the resize duration of container image. These number are miliseconds. 400 is default.
overlayBgColor: "#999999", // (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
overlayOpacity: .6, // (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
txtImage: 'Image', //Default text of image
txtOf: 'of'
});
});
// EndOAWidget_Instance_2127022
</script>
这是手风琴
<script type="text/javascript"> // BeginOAWidget_Instance_2028523: #jQueryUIAccordion $(function(){ // Accordion $("#jQueryUIAccordion").accordion({ header: "h3", > animated: "slide", event: "click", collapsible : "false" }); }); // EndOAWidget_Instance_2028523 </script> <!-- Accordion --> <div id="jQueryUIAccordion" class="ui-gray-icons "> <div> <h3><a href="#">First</a></h3> <div> Vivamus rutrum, sapien ac fermentum imperdiet, nisi libero mattis quam, eu mollis sem metus id ligula. </div> </div> <div> <h3><a href="#">Second</a></h3> <div>it, tristique egestas erat interdum id.</div> </div> <div> <h3><a href="#">Third</a></h3> <div>Nam dui erat, auctor a, dignissim quis.</div> </div>
我希望我没有失去你。我想强调,我没有对剧本做任何修改!它们与我从Dreamweaver中添加的相同。谢谢 !
更新:我解决了这个问题。对于有这个问题的其他用户,只需从lightbox中删除jquery,手风琴的jquery将照顾灯箱和手风琴!它可以关闭
后更新。我观察到只有歌剧加载OK手风琴和灯箱。 Firefox并没有加载手风琴和灯箱。这是控制台错误: [12:56:53.907] $(“#jQueryUIAccordion”)。accordion is not a function @http://localhost/SITE/incercare3.php#:190 [12:56:53.969] $(“#gallery a”)。lightBox is not a功能@http://localhost/SITE/incercare3.php#:275
铬也犯规加载2个脚本:这是错误铬给我:
未捕获的类型错误:对象[对象的对象]无方法“手风琴” 未捕获的类型错误:对象[对象的对象]没有方法'lightBox'
意见?
jQuery UI的1.7手风琴! –
好的,但jquery ui使用jQuery 1.3,并且为你的lightbox装载一个更新的jquery,它会重载$ global var,并且你将失去手风琴功能。在jquery noConflict文档中,其他一些文档也存在相同的问题....尝试使用noConflict加载第二个javascript实例,并使用像$$这样的不同变量。然后在新窗口中添加更新的插件。$$引用更新的jQuery –