我在单个项目中使用 Bootstrap 和 Fancybox,包括它:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
这些文件存在并被 Chrome 包含。
创建 Fancybox 元素时:
$(document).ready(function() {
[...]
jQuery("a.fancy").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none'
});
});
JS 抛出错误:
Uncaught TypeError: Cannot read property 'msie' of undefined jquery.fancybox-1.3.4.pack.js:18
Uncaught TypeError: Object [object Object] has no method 'fancybox'
( Bootstrap 功能正在工作)
这是命名空间问题吗?
最佳答案
DOM 是在调用 fancybox 之前加载的吗?如果不试试这个:
$(document).ready(function() {
$('a.fancy').fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none'
});
});
关于jquery-plugins - 在单个项目中使用 Bootstrap 和 Fancybox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14348749/