javascript - c.easing[this.options.specialEasing && this.options.specialEasing[this.prop] || a] 在使用 JQuery Easing 插件时不是一个函数

标签 javascript jquery jquery-ui jquery-plugins

尝试在我的 wordpress 中使用 JQuery Easing 插件,但出现以下错误 (firebug)

c.easing[this.options.specialEasing && this.options.specialEasing[this.prop] || a] is not a function

我已经包含了 JQuery 1.4.2,在进行了一些谷歌搜索后,我什至添加了 jquery.easing.compatibility.js 以及 jquery.easing.1.3.js 但是问题依然存在。

任何人都可以让我知道可能是什么问题。作为附加说明,我也在使用 fancybox,所以我的代码中包含以下 js

jquery.mousewheel-3.0.4.pack.js
jquery.fancybox-1.3.4.pack.js

她的是我正在使用的代码

<script type='text/javascript'>
$(document).ready(function() {
    function anim(duration){
        $('#mint').animate(
            {height: 'toggle'},
            {duration: duration, specialEasing: {height: 'easeOutBounce'}}
        );
    }

    $('#closebtn').click(function() {
        $('#mintbar').slideUp();
        anim(800);
    });

    $('#mint').click(function() {
        anim(500);
        $('#mintbar').slideDown('slow','easeOutBounce');
    });
});

最佳答案

如果你说它可以独立工作但不能与 WordPress 一起工作,那可能是因为你处于 noConflict 模式,所以你需要使用 jQuery 而不是它的快捷方式,$。代替 $('#mint'),执行 jQuery('#mint')。其他所有 jQuery 对象都一样。

无论如何,您是如何在 WordPress 中包含 jQuery 的?它已经与它捆绑在一起。如果您要附加自己的版本,则需要以正确的方式进行。所有其他脚本也应该加载到 functions.php 中,而不是在 header 中。

functions.php

function my_add_scripts() {

    // Unload bundled jQuery
    wp_deregister_script( 'jquery' );

    // jQuery
    wp_register_script( 'jquery', ('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'), 0, 0, 1 );
    wp_enqueue_script( 'jquery' );

    // mousewheel
    wp_register_script( 'mousewheel', get_template_directory_uri() . '/js/mousewheel.js', 0, 0, 1 );
    wp_enqueue_script( 'mousewheel' );

    // fancybox
    wp_register_script( 'fancybox', get_template_directory_uri() . '/js/fancybox.js', 0, 0, 1 );
    wp_enqueue_script( 'fancybox' );

}
add_action( 'wp_enqueue_scripts', 'my_add_scripts' );

关于javascript - c.easing[this.options.specialEasing && this.options.specialEasing[this.prop] || a] 在使用 JQuery Easing 插件时不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9238067/

相关文章:

javascript - 如何限制 git 跟踪/更新本地更改?

javascript - IE10 : getElementsByName() is not returning the elements that has same Id in IE10

javascript - gulp 模式递归如何工作 **/*

javascript - 单击一个数据表,填充第二个数据表

jquery - 同时 ajax 调用会导致随机错误

jquery - 拖放到特定位置 + 占用 Main Div 中的可用空间

ajax - jQuery/Ajax:如何填充多个字段

javascript - 检测过度滚动的结束

asp.net - 如何从受 SSL 保护的页面使用 jquery ajax 调用 WCF 服务?

jQuery UI 可在表单元素上拖动