最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery("ul.sf-menu").superfish is not a function - Stack Overflow

programmeradmin4浏览0评论

Receiving an error "jQuery("ul.sf-menu").superfish is not a function" during site load in Firefox, if I delete the superfish, it errors out upon the next snippet of javascript leading me to believe it's a jQuery reference error, which has been quadruple-checked and confirmed it's being loaded: /?page_id=7

Here is the jquery being loaded fine in the header:

 <script type='text/javascript' src='.8.1.min.js?ver=1.8.1'></script>

Here is the code referenced in the footer:

              <script type="text/javascript">
                // initialise plugins
                        jQuery(document).ready(function(){
                        // main navigation init
                        jQuery('ul.sf-menu').superfish({
                            delay:       '<?php echo get_option('my_framework_sf_delay'); ?>',      // one second delay on mouseout 
                            animation:   {opacity:'<?php echo get_option('my_framework_sf_fade_in'); ?>',height:'<?php echo get_option('my_framework_sf_slide_down'); ?>'}, // fade-in and slide-down animation 
                            speed:       '<?php echo get_option('my_framework_sf_speed'); ?>',  // faster animation speed 
                            autoArrows:  <?php echo get_option('my_framework_sf_arrows'); ?>,        // generation of arrow mark-up (for submenu) 
                            dropShadows: <?php echo get_option('my_framework_sf_dropshadows'); ?>    // drop shadows (for submenu)
                        });

                        // prettyphoto init
                        jQuery("#gallery .portfolio a[rel^='prettyPhoto']").prettyPhoto({
                            animationSpeed:'slow',
                            theme:'facebook',
                            slideshow:false,
                            autoplay_slideshow: false,
                            show_title: true,
                            overlay_gallery: false
                        });

                    });
              </script>

                <?php if( is_front_page() || is_home() ) { ?>
                    <script type="text/javascript">
                        jQuery(document).ready(function(){
                          //  Initialize Backgound Stretcher
                            jQuery(document).bgStretcher({
                             images: ['<?php bloginfo( 'template_url' ); ?>/images/body-1.jpg'], imageWidth: 1920, imageHeight: 1200
                            });
                        });
                  </script>
               <?php } ?>

                <script type="text/javascript">
                jQuery(document).ready(function(){
                      //  Initialize Backgound Stretcher
                        jQuery(document).bgStretcher({
                         images: ['<?php bloginfo( 'template_url' ); ?>/images/body-2.jpg'], imageWidth: 1920, imageHeight: 1200
                        });
                    });
               </script>

Basically the superfish, bgstretcher and pretty photo js references should all load correctly on the above URL but they continue to fail loading one by one starting with the suckerfish js. Thanks in advance!

Receiving an error "jQuery("ul.sf-menu").superfish is not a function" during site load in Firefox, if I delete the superfish, it errors out upon the next snippet of javascript leading me to believe it's a jQuery reference error, which has been quadruple-checked and confirmed it's being loaded: http://yolokids.previewdns./?page_id=7

Here is the jquery being loaded fine in the header:

 <script type='text/javascript' src='http://yolokids.previewdns./wp-content/themes/theme1270/js/jquery-1.8.1.min.js?ver=1.8.1'></script>

Here is the code referenced in the footer:

              <script type="text/javascript">
                // initialise plugins
                        jQuery(document).ready(function(){
                        // main navigation init
                        jQuery('ul.sf-menu').superfish({
                            delay:       '<?php echo get_option('my_framework_sf_delay'); ?>',      // one second delay on mouseout 
                            animation:   {opacity:'<?php echo get_option('my_framework_sf_fade_in'); ?>',height:'<?php echo get_option('my_framework_sf_slide_down'); ?>'}, // fade-in and slide-down animation 
                            speed:       '<?php echo get_option('my_framework_sf_speed'); ?>',  // faster animation speed 
                            autoArrows:  <?php echo get_option('my_framework_sf_arrows'); ?>,        // generation of arrow mark-up (for submenu) 
                            dropShadows: <?php echo get_option('my_framework_sf_dropshadows'); ?>    // drop shadows (for submenu)
                        });

                        // prettyphoto init
                        jQuery("#gallery .portfolio a[rel^='prettyPhoto']").prettyPhoto({
                            animationSpeed:'slow',
                            theme:'facebook',
                            slideshow:false,
                            autoplay_slideshow: false,
                            show_title: true,
                            overlay_gallery: false
                        });

                    });
              </script>

                <?php if( is_front_page() || is_home() ) { ?>
                    <script type="text/javascript">
                        jQuery(document).ready(function(){
                          //  Initialize Backgound Stretcher
                            jQuery(document).bgStretcher({
                             images: ['<?php bloginfo( 'template_url' ); ?>/images/body-1.jpg'], imageWidth: 1920, imageHeight: 1200
                            });
                        });
                  </script>
               <?php } ?>

                <script type="text/javascript">
                jQuery(document).ready(function(){
                      //  Initialize Backgound Stretcher
                        jQuery(document).bgStretcher({
                         images: ['<?php bloginfo( 'template_url' ); ?>/images/body-2.jpg'], imageWidth: 1920, imageHeight: 1200
                        });
                    });
               </script>

Basically the superfish, bgstretcher and pretty photo js references should all load correctly on the above URL but they continue to fail loading one by one starting with the suckerfish js. Thanks in advance!

Share Improve this question asked Sep 4, 2012 at 18:28 blkedyblkedy 1,2432 gold badges13 silver badges20 bronze badges 1
  • 1 The "superfish" plugin is probably not loaded: where are those extension functions defined? – user166390 Commented Sep 4, 2012 at 18:29
Add a ment  | 

2 Answers 2

Reset to default 4

On line 202, you reload jQuery for your slider. This effectively overwrites the $ and jQuery variables removing all additional plugins.

i changed your call of:

jQuery('ul.sf-menu').superfish()

to:

$('ul.sf-menu').superfish()

and it didn't throw the error for me.

发布评论

评论列表(0)

  1. 暂无评论