当我为灯箱包含js时,它会阻止我的其他js运行;这意味着我的jquery导航和滑动效果
div停止工作。我是否正确包含文件?我在脚本的顶部尝试了endconflict()但是没有用。任何帮助是极大的赞赏。 THX
<link rel="stylesheet" type="text/css" href="jquery-lightbox-0.5/css/jquery.lightbox-0.5.css" media="screen" /> <link rel="stylesheet" href="css/bootstrap.css" type="text/css">
<link rel="stylesheet" href="css/bootstrap-responsive.css" type="text/css">
<link rel="stylesheet" href="css/style.css" type="text/css">
***<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />***
<script type="text/javascript" src="js/jquery.js"></script>
<script src="javascript/jquery-1.7.1.min.js"></script>
<script src="javascript/bootstrap.js"></script>
***<script type="text/javascript" src="../lightbox2.05/js/prototype.js"></script>
<script type="text/javascript" src="../lightbox2.05/js/scriptaculous.js"></script>
<script type="text/javascript" src="../lightbox2.05/js/lightbox.js"></script>***
<script>
<a href="images/Screen Shot 2012-02-27 at 9.51.49 PM.png" rel="lightbox">
<img src="../../images/Screen Shot 2012-02-27 at 9.56.49 PM.png" height="180" width="460" alt="">
</a>
答案 0 :(得分:0)
问题是lighbox使用了Scriptaculous和Prototype的部分,这些是jQuery之类的其他javascript库。他们不能很好地与每个人玩,所以你必须告诉jQuery避免它们。
而不是通常将jQuery代码放入的典型文档就绪设置:
$(document).ready(function() {
// Stuff to do as soon as the DOM is ready;
});
您将在此处包装jQuery代码:
jQuery(document).ready(function($){
// Stuff to do as soon as the DOM is ready;
});
您可以在此处阅读有关处理JavaScript库冲突的更多信息:http://docs.jquery.com/Using_jQuery_with_Other_Libraries