JS中的语法错误

Kir*_*rks 0 javascript wordpress jquery

我使用自定义js编写的小提琴,我想将它集成到我的wordpress主题:我已经使用了寄存器和排队脚本如下,它们似乎正确加载,但它是custom.js似乎是错误的.

如果我错过了标签或某些东西,我可以告诉我,因为我卡住了.以下是我的代码: -

/ 我的职能档案 /

<?php
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") ."://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');

wp_register_script( 'jquery-ui', get_template_directory_uri().'/js/jquery-ui.min.js', array('jquery'), true );
wp_enqueue_script( 'jquery-ui' );

wp_register_script( 'custom', get_template_directory_uri().'/js/custom.js', array('jquery-ui'), true );
wp_enqueue_script( 'custom' );
}
?>
Run Code Online (Sandbox Code Playgroud)

/ 我的自定义JS文件* /

$(document).ready(function() {  
$("h1, h2").on('click', function (e) {
e.preventDefault();
$(this).effect( "bounce", { times : 2, direction : "down", distance : "3" }, 200)
});
Run Code Online (Sandbox Code Playgroud)

谢谢你Kirsty

Mag*_*ker 7

你忘了关闭你的文件了

$(document).ready(function() {
    $("h1, h2").on('click', function(e) {
        e.preventDefault();
        $(this).effect("bounce", {
            times: 2,
            direction: "down",
            distance: "3"
        }, 200);
    });
});?
Run Code Online (Sandbox Code Playgroud)