错误$ .supersized({

时间:2012-08-15 17:12:57

标签: wordpress jquery-plugins supersized

我为主页重新设计构建了此标头模板。一切都在MAMP本地运行良好,但是当我将头文件加载到客户端的文件夹时出现问题。我继续在firebug中得到这个错误:TypeError:$ .supersized不是函数

我查看了每个网站,关于该主题的每个帖子,似乎没有任何效果。这是代码:

<?php wp_enqueue_style( 'style', get_bloginfo('template_url').'/style.css');
wp_enqueue_style( 'supersized_style', get_bloginfo('template_url').'/supersized/css/supersized.css');
wp_enqueue_script( 'supersized_js',get_bloginfo('template_url').'/supersized/js/jquery.min.js', array('jquery'));
wp_enqueue_script( 'supersized_js', get_bloginfo('template_url').'/supersized/js/supersized.3.2.7.min.js', array('jquery'));
wp_enqueue_script( 'supersized_js', get_bloginfo('template_url').'/supersized/js/supersized.shutter.min.js', array('jquery'));?>

<?php wp_head(); ?>

    <script type="text/javascript">  

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

                //Functionality
                slideshow               :   1,      //Slideshow on/off
                autoplay                :   1,      //Slideshow starts playing automatically
                start_slide             :   1,      //Start slide (0 is random)
                slide_interval          :   5000,   //Length between transitions
                transition              :   1,      //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
                transition_speed        :   500,    //Speed of transition
                new_window              :   0,      //Image links open in new window/tab
                pause_hover             :   0,      //Pause slideshow on hover
                keyboard_nav            :   1,      //Keyboard navigation on/off
                performance             :   2,      //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
                image_protect           :   1,      //Disables image dragging and right click with Javascript
                image_path              :   'supersize/img/', //Default image path

                //Size & Position
                min_width               :   0,      //Min width allowed (in pixels)
                min_height              :   0,      //Min height allowed (in pixels)
                vertical_center         :   0,      //Vertically center background
                horizontal_center       :   1,      //Horizontally center background
                fit_portrait            :   0,      //Portrait     images will not exceed browser height
                fit_landscape           :   0,      //Landscape images will not exceed browser width

                //Components
                navigation              :   1,      //Slideshow controls on/off
                thumbnail_navigation    :   0,      //Thumbnail navigation
                slide_counter           :   1,      //Display slide numbers
                slide_captions          :   1,      //Slide caption (Pull from "title" in slides array)
                slides                  :   [           //Slideshow Images
{image : 'wp-content/themes/photo_philanthropy/supersized/slides/calvert.jpg', 
title : '<div id="tab"><h6 class="cap-tab">WHAT WE DO</h6><br/></div><div id="image-cap"><div id="main-title" ><h6 class="main-title" style="font-size:22px;line-height:135%;">PhotoPhilanthropy brings together photographers and non-profit organizations to create images that change the world.</h6></div></div><div id="photo-cap"><p class="photo-cap">WORLD VISION&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;PHOTO BY MARY F. CALVERT</p><p class="photo-cap" style="line-height:200%;">According to Human Rights Watch, local civilians continue to suffer from widespread instances of rape by Congolese forces.</p></div>', 
 url : 'photophilanthropy.org/www/blogmedia/wp-        content/themes/photophil/supersized/slides/'},  

{image : 'wp-content/themes/photo_philanthropy/supersized/slides/wakatobi.jpg', 
title : '<div id="tab"><h6 class="cap-tab">GRANTS FOR CHANGE</h6><br/></div><div id="image-cap"><div id="main-title"><h6 class="main-title" style="font-size:36px;">EMPOWERING NON-PROFITS</h6><br/><h6 class="subheading">Showcasing collaborations between photographers and nonprofits on the frontlines of social change.</h6></div></div><div id="photo-cap"><p class="photo-cap">WORLD WILDLIFE FUND&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;PHOTO BY JAMES MORGAN</p><p class="photo-cap" style="line-height:200%;">Enal plays with his pet shark, Wakatobi, Indonesia.</p></div>',
url : 'photophilanthropy.org/www/blogmedia/wp-        content/themes/photophil/supersized/slides/'},  

{image : 'wp-content/themes/photo_philanthropy/supersized/slides/valdisteno.jpg', 
title : '<div id="tab"><h6 class="cap-tab">EXHIBITIONS FOR CHANGE</h6><br/></div><div id="image-cap"><div id="main-title"><h6 class="main-title" style="font-size:36px;">AGENTS FOR CHANGE</h6><br/><h6 class="subheading">Recognizing the photgraphers who focus their lens on today’s most critical issues.</h6></div></div></div><div id="photo-cap"><p class="photo-cap">THE UMBRELLA FOUNDATION&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;PHOTO BY NICOLETTA VALDISTENO</p><p class="photo-cap" style="line-height:200%;">A young girl in the Kathmandu Valley moves bricks after they have dried and are now ready to be cooked.</p></div>',
url : 'photophilanthropy.org/www/blogmedia/wp-content/themes/photophil/supersized/slides/'}, 

{image : 'wp-content/themes/photo_philanthropy/supersized/slides/samburu.jpg', 
title : '<div id="tab"><h6 class="cap-tab">THE UNITED NATIONS</h6><br/></div><div id="image-cap"><div id="main-title" style="padding-top:5px;"><h6 class="main-title" style="font-size:44px;">BEHIND THIS FACE IS A STORY</h6><br/></div></div><div id="photo-cap"><p class="photo-cap"> BLUE PLANET NETWORK and THE SAMBURU PROJECT&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;PHOTO BY RUDI DUNDAS</p><p class="photo-cap"style="line-height:200%;">The Face of Water is the story of the women of Samburu who have spent lifetimes struggling to provide water for their families.</p></div>',
url : 'photophilanthropy.org/www/blogmedia/wp-content/themes/photophil/supersized/slides/'} ]

            }); 
        });

    </script>

3 个答案:

答案 0 :(得分:0)

由于某种原因,浏览器似乎没有加载超大的脚本。检查Web服务器和firebug的日志,以确保加载了supersized.3.2.7.min.js。如果有一堆404 - 网络服务器日志将澄清原因。

答案 1 :(得分:0)

我认为它与另一个自定义javascript文件发生冲突。重新检查所有jQuery脚本是否使用jQuery(document).ready函数或仅使用jQuery(function($))启动其他.js。

TypeError:$ .supersized不是函数”是由于jQuery冲突而由firebug抛出的常见错误。

答案 2 :(得分:0)

我不得不使用:

jQuery(function($){

$.supersized({...
...
});

});

希望有所帮助