0

我在页面上收到这两个错误:

ReferenceError:Cufon 未定义

TypeError: $(".main_equal2").equalHeights 不是函数

我正在使用带有 simplemarket 主题的 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>
4

2 回答 2

1

在 wordpress 中使用 jQuery 而不是 $ 或使用

jQuery(document).ready(function($){

在代码中启用 $。

于 2012-08-10T19:33:18.133 回答
-2

有两个 jQuery 包含并且正在使用 $. 而不是 jQuery。感谢所有的建议。

于 2012-08-14T05:47:01.983 回答