0

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

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

<?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>
4

3 回答 3

0

看起来您的超大脚本由于某种原因没有被浏览器加载。检查 web 服务器和 firebug 的日志以确保 supersized.3.2.7.min.js 被加载。如果有一堆 404 - Web 服务器日志将阐明原因。

于 2012-08-16T00:08:08.970 回答
0

我不得不使用:

jQuery(function($){

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

});

希望有帮助

于 2013-03-27T17:19:37.987 回答
0

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

TypeError: $.supersized is not a function ”是firebug由于jQuery冲突而抛出的常见错误。

于 2012-10-05T06:40:11.823 回答