Question

I get both of these errors on the page:

ReferenceError: Cufon is not defined

TypeError: $(".main_equal2").equalHeights is not a function

I'm using Wordpress with the simplemarket theme. All script files are loaded in the header.php and is included below.

Can anyone help with my issues?

    <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>
Was it helpful?

Solution 2

Had two jQuery includes and was using $. instead of jQuery. Thanks for all the advice.

OTHER TIPS

Either use jQuery instead of $ as you are in wordpress or use

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

to enable $ in code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top