我在页面上遇到这两个错误:
ReferenceError:未定义Cufon
TypeError:$(" .main_equal2").equalHeights不是函数
我使用Wordpress与简单市场主题。所有脚本文件都加载到header.php中,并包含在下面。
任何人都可以帮我解决问题吗?
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url') ?>/scripts/cufon.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url') ?>/scripts/avenir_400.font.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url') ?>/scripts/equal_heights.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url') ?>/scripts/html5shiv.js"></script>
<script type="text/javascript" src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
<!--<script src="<?php bloginfo('template_url') ?>/scripts/googlemapselector.js"></script>-->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<!--[if lte IE 8]>
<script src="<?php bloginfo('template_url') ?>/scripts/selectivizr-min.js" type="text/javascript"></script>
<![endif]-->
<script type="text/javascript">
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(40.718510, -73.774080);
var mapOptions = {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas_sat"), mapOptions);
var image = 'images/school_icon.png';
var marker = new google.maps.Marker({
map: map,
position: latlng,
animation: 'drop',
icon: image
});
}
$(document).ready(function(){
$(".main_equal2").equalHeights();
$(".main_equal3").equalHeights2();
$(".main_equal4").equalHeights3();
});
jQuery(document).ready(function(){
// Anything classed with .collapse should be collapsed as well by default
i = 0;
jQuery('.collapse').each(function() {
this.id = 'collapser-' + Math.floor( Math.random() * ( Math.random() * 10000 ) );
jQuery(this).wrap('<div id="' + this.id + '-expand"></div>');
if(i == 0) {
jQuery(this).before('<a class="dark_stripe" id="' + this.id + '-link" href="#" onclick="javascript:jQuery(\'#' + this.id + '\').slideToggle();return false;">Click</a>');
i++;
} else if(i == 1) {
jQuery(this).before('<a class="light_stripe" id="' + this.id + '-link" href="#" onclick="javascript:jQuery(\'#' + this.id + '\').slideToggle();return false;">Click</a>');
i = 0;
}
jQuery(this).wrap( '<div></div>' );
jQuery(this).slideUp();
});
jQuery(".athletics_map_location").click(function() {
var address = $(this).attr('value');
var image = 'http://www.bigideaadv.com/tmla/wp-content/themes/simplemarket/images/school_icon.png';
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
animation: 'drop',
position: results[0].geometry.location,
icon: image
});
/*shadow: Symbol({
fillColor: '#00ff00'
}),*/
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
});
jQuery(".athletics_map_location2").click(function() {
var address = $(this).attr('value');
var image = 'http://www.bigideaadv.com/tmla/wp-content/themes/simplemarket/images/facility_icon.png';
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
animation: 'drop',
position: results[0].geometry.location,
icon: image
});
/*shadow: Symbol({
fillColor: '#00ff00'
}),*/
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
//FONT REPLACEMENT FOR RIGHTS PROTECTED AVENIR FONT
Cufon.replace('#athletics_menu ul#menu-athletics-menu a:link, #athletics_menu ul#menu-athletics-menu a:visited, #athletics_menu ul#menu-athletics-menu a:hover, #athletics_menu ul#menu-athletics-menu a:active');
Cufon.replace('#athletics_sidebar_right aside.widget h3, #athletics_sidebar_bottom_left aside.widget h3, #athletics_sidebar_bottom_center aside.widget h3, .page-template-template-athletics-sports-page-php aside.widget h3');
});
$(function() {
// initialize scrollable
var root = $(".scrollable").scrollable({circular: true, speed: 1000}).autoscroll({ autoplay: true, interval: 5000 });
//$(".scrollable").scrollable();
});
});
</script>
答案 0 :(得分:1)
使用jQuery而不是$,因为你在wordpress或使用
jQuery(document).ready(function($){
启用代码中的$。
答案 1 :(得分:-2)
有两个jQuery包含并且正在使用$。而不是jQuery。感谢您的所有建议。