未捕获的TypeError:$(...)。shadow不是函数

时间:2015-06-26 17:11:00

标签: javascript php jquery wordpress

我将wordpress转移到服务器后,jquenry无效。但我的localhost工作正常。我仍然困惑,我有一个代码给你。请帮帮我!

function.php

  function twentythirteen_scripts_styles() {

 //shadow
wp_enqueue_script( 'sh1', get_template_directory_uri() . '/jQuery-Shadow-master/jquery.shadow/jquery-1.5.min.js', array( 'jquery' ));
wp_enqueue_script( 'sh2', get_template_directory_uri() . '/jQuery-Shadow-master/jquery.shadow/jquery.shadow.js', array( 'jquery' ));
wp_enqueue_style( 'sh3', get_template_directory_uri() . '/jQuery-Shadow-master/jquery.shadow/jquery.shadow.css', array() );


    wp_register_style( 'jqueryshadow-css', get_template_directory_uri() . '/jQuery-Shadow-master/jquery.shadow/jquery.shadow.css', array());
wp_enqueue_style ( 'jqueryshadow-css');

wp_register_script ('jqueryshadow-js', get_stylesheet_directory_uri() . '/jQuery-Shadow-master/jquery.shadow/jquery.shadow.js', array( 'jquery' ));
wp_enqueue_script  ('jqueryshadow-js');

wp_register_script ('jquery-15-js', get_stylesheet_directory_uri() . '/jQuery-Shadow-master/jquery.shadow/jquery-1.5.min.js', array( 'jquery' ));
wp_enqueue_script('jquery-15-js');
}add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );

脚本在这里

 <script>
jQuery(document).ready(function($)  {

    $('.navbar.raised').shadow('raised');
    $('.sub-menu.raised').shadow('raised');
    $('.nav-toggle.raised').shadow('raised');
    $('.navbar.raised').shadow('raised');

   });
 </script>  

我打开&lt;头&gt;控制台在铬。功能存在。

<link rel="stylesheet" id="sh3-css" href="http://tkmultiply.com/wp-content/themes/twentythirteen%20to%20web%20V1/jQuery-Shadow-master/jquery.shadow/jquery.shadow.css?ver=4.2.2" type="text/css" media="all">
<script type="text/javascript" src="http://tkmultiply.com/wp-content/themes/twentythirteen%20to%20web%20V1/jQuery-Shadow-master/jquery.shadow/jquery.shadow.js?ver=4.2.2"></script>
<script type="text/javascript" src="http://tkmultiply.com/wp-content/themes/twentythirteen%20to%20web%20V1/jQuery-Shadow-master/jquery.shadow/jquery-1.5.min.js?ver=4.2.2"></script>

这是jquery.shadow.js

(function( $ ){


$.fn.shadow = function(options) {  

    // options could just be the type
    if (typeof options !== "object")
        options = {type:options};

    // set up the options using the defaults
    options = $.extend({}, $.fn.shadow.defaults, options);

    var els = this;

    // add the necessary css classes
    els.addClass('jquery-shadow');
    els.addClass('jquery-shadow-'+options.type);    

    // some require extras js      
    switch(options.type) {
        case 'sides' :
            $.fn.shadow.sides(this,options);
            break;
        case 'rotated' :
            $.fn.shadow.rotated(this,options);
            break;      
    }

    // for good measure :)
    $.fn.shadow.borderRadius(this,options.radius);      

    return this;
};

// rotate these bad boys
$.fn.shadow.rotated = function(els,options) {

    // one property to rule them all, if only!
    els.css('-webkit-transform','rotate('+options.rotate+')')
        .css('-moz-transform','rotate('+options.rotate+')')
        .css('-ms-transform','rotate('+options.rotate+')')
        .css('-o-transform','rotate('+options.rotate+')')
        .css('transform','rotate('+options.rotate+')');
}

// sides have funky stuff   
$.fn.shadow.sides = function(els,options) {
    els.addClass('jquery-shadow-sides-'+options.sides);
}

// border-radius goodness..
$.fn.shadow.borderRadius = function(els,radius) {
    els.css('-moz-border-radius',radius)
        .css('border-radius',radius);
}

// these are the defaults :)
$.fn.shadow.defaults = {
    type:'standard', // AVAILABLE standard, lifted, perspective, raised, sides
    radius:4,
    sides:'', // used when type = "sides", AVAILABLE vt-1, vt-2, hz-1, hz-2
    rotate:'-3deg'
};

})( jQuery );

0 个答案:

没有答案