Javascript jQuery冲突,可能的引导问题?
我在尝试运行jQuery时遇到了问题。我正试图在我的引导应用程序中实现这一点: 但是,当我尝试在我的引导应用程序中实现此功能时,会出现一系列错误,例如:Javascript jQuery冲突,可能的引导问题?,javascript,jquery,twitter-bootstrap,Javascript,Jquery,Twitter Bootstrap,我在尝试运行jQuery时遇到了问题。我正试图在我的引导应用程序中实现这一点: 但是,当我尝试在我的引导应用程序中实现此功能时,会出现一系列错误,例如: Uncaught TypeError: Cannot call method 'fadeIn' of null index.php:108 Uncaught TypeError: Cannot call method 'animate' of null index.php:109 我尝试过几种方法来解决这个问题,但都没有成功。我正在使用jq
Uncaught TypeError: Cannot call method 'fadeIn' of null index.php:108
Uncaught TypeError: Cannot call method 'animate' of null index.php:109
我尝试过几种方法来解决这个问题,但都没有成功。我正在使用jquery/1.10.1/如果有帮助的话
编辑:
以下是我页脚中的代码:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(function(){
$('#iphone-img').mouseover(function(){
$('.main-content-box').fadeIn(600).show(); //on mouse enter show div
});
$('#iphone-img').mouseleave(function(){
$('.main-content-box').animate({opacity: 'toggle'}, 'slow');
});
});
</script>
<script src="js/bootstrap.js"></script>
<script type='text/javascript' src='js/lib/prototype.js'></script>
<script type='text/javascript' src='js/lib/raphael.js'></script>
<script type='text/javascript' src='js/lib/highlight.js'></script>
<script type='text/javascript' src='js/analytics.js'></script>
<script type="text/javascript">
$(function () {
$('#info-tabs').tab('show');
});
$(function(){
$('#pop-info').tooltip('hide');
});
$(function(){
$('#videoModal').modal('hide');
});
</script>
<script type='text/javascript'>
function onLoad(){
Element.observe(window,'load', function(){
var w = 840;
var h1 = Raphael('beautiful-line-chart1', w, 250);
var h2 = Raphael('beautiful-line-chart2', w, 250);
//var h3 = Raphael('beautiful-line-chart3', w, 250);
//var h4 = Raphael('beautiful-line-chart4', w, 250);
/* Line Chart 2; table_id:e3 tbody-class: line_e3 table_id:e33 */
drawLine({
holder: h1,
data_holder: 'd2',
mastercolor: '#01A8F0',
spewidth: w,
showarea: true,
mousecoords: 'circle',
nodot: true
});
drawLine({
holder: h1,
data_holder: 'd1',
mastercolor: '#666',
spewidth: w,
showarea: true,
mousecoords: 'circle',
});
drawLine({
holder: h2,
data_holder: 'e3',
mastercolor: '#555',
spewidth: w,
showarea: false,
mousecoords: 'circle',
gridcolor: '#333333',
nodot: true
});
drawLine({
holder: h2,
data_holder: 'e3',
mastercolor: '#8dd916',
spewidth: w,
showarea: true,
mousecoords: 'circle',
gridcolor: '#333333',
dotcolor: '#333333'
});
drawLine({
holder: h3,
data_holder: 'd2',
mastercolor: '#d90000',
spewidth: w,
showarea: false,
mousecoords: 'rect'
});
drawLine({
holder: h4,
data_holder: 'd2',
mastercolor: '#ccc',
spewidth: w,
showarea: false,
nodot: true // hide dots
});
drawLine({
holder: h4,
data_holder: 'd1',
mastercolor: '#eb2682',
spewidth: w,
showarea: true,
nodot: true // hide dots
});
});
// Just used in the code highlighter
hljs.tabReplace = ' ';
hljs.initHighlightingOnLoad();
}
onLoad();
</script>
<script type="text/javascript">
$('#myCarousel').carousel({
interval: 2000
});
</script>
</body>
它仍然不起作用。问题在于原型库重写了
$
jQuery的$
引用,即在您的代码中$
引用的是protorype库而不是jQuery
您需要使用来解决此问题,或者使用jQuery来引用jQuery库,而不是$
jQuery(function($){
$('#info-tabs').tab('show');
$('#pop-info').tooltip('hide');
$('#videoModal').modal('hide');
})
发布html代码,包括参考。请提供代码的url,因为小提琴正在正常工作。页面中还包括哪些其他库?是否添加了原型库?是否使用
$
访问更新的jQueryOP。是的,我使用的是原型库,这会导致问题吗?我用它在不同的页面上显示图形数据。
jQuery(function($){
$('#info-tabs').tab('show');
$('#pop-info').tooltip('hide');
$('#videoModal').modal('hide');
})