例如,除非我调用脚本两次,否则下面的两个代码片段将不起作用。请帮帮忙。(在我的页面上还有更多的jquery调用,也调用了不同的库),难道我不能只调用最新的库一次并完成它吗?我试过了,但不起作用。
<!--menu -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/newnav.css" />
<script type="text/javascript" src="js/navdoublecolumn.js"></script>
<script>
<!--
ddmegamenu.docinit({
menuid:'solidmenu',
dur:0,
easing:'easeInOutCirc' //<--no comma after last setting
})
// -->
</script>
<!-- slide -->
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/jquery.tabSlideOut.v1.3.js"></script>
<script type="text/javascript">
$(function(){
$('.slideout1').tabSlideOut({
tabHandle: '.slideouthandle1', //class of the element that will become your tab
pathToTabImage: 'images/slideouttab_chat.jpg',//path to the image for the tab //Optionally can be set using css
imageHeight: '150px', //height of tab image //Optionally can be set using css
imageWidth: '40px', //width of tab image //Optionally can be set using css
tabLocation: 'left', //side of screen where tab lives, top, right, bottom, or left
speed: 200, //speed of animation
action: 'click', //options: 'click' or 'hover', action to trigger animation
topPos: '215px', //position from the top/ use if tabLocation is left or right
leftPos: '20px', //position from left/ use if tabLocation is bottom or top
fixedPosition: true //options: true makes it stick(fixed position) on scroll
});
});
</script>发布于 2013-01-25 17:41:33
我认为navdoublecolumn.js中的某些东西会重写或破坏jQuery功能。通过第二次包含jQuery,您可以重新定义方法/变量,从而恢复navdoublecolumn.js破坏的功能。
您可以通过查看在删除第二个jQuery包含时获得的javascript控制台错误输出,来了解破坏的原因。
发布于 2013-01-25 19:23:22
在使用jQuery.noconflict()时,请使用以下代码:
jQuery(function($){
$('.slideout1').tabSlideOut({
tabHandle: '.slideouthandle1', //class of the element that will become your tab
pathToTabImage: 'images/slideouttab_chat.jpg',//path to the image for the tab //Optionally can be set using css
imageHeight: '150px', //height of tab image //Optionally can be set using css
imageWidth: '40px', //width of tab image //Optionally can be set using css
tabLocation: 'left', //side of screen where tab lives, top, right, bottom, or left
speed: 200, //speed of animation
action: 'click', //options: 'click' or 'hover', action to trigger animation
topPos: '215px', //position from the top/ use if tabLocation is left or right
leftPos: '20px', //position from left/ use if tabLocation is bottom or top
fixedPosition: true //options: true makes it stick(fixed position) on scroll
});
});https://stackoverflow.com/questions/14518945
复制相似问题