Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript动画不工作_Javascript_Jquery_Html_Css_Jquery Animate - Fatal编程技术网

Javascript动画不工作

Javascript动画不工作,javascript,jquery,html,css,jquery-animate,Javascript,Jquery,Html,Css,Jquery Animate,我有一个div宽度id:“cen”,高度和宽度为50px $(document).ready(function() { $("#cen").animate({ height: 500px, width: "500px", }, 5000, function() { // Animation complete. }); }); 但它不起作用。在500px附近加引号 您的语法有错误,高度应在“500px”附近 应该是 $(d

我有一个div宽度id:“cen”,高度和宽度为50px

$(document).ready(function() {
    $("#cen").animate({
        height: 500px,
        width: "500px",
    }, 5000, function() {
        // Animation complete.
    });
});

但它不起作用。

500px附近加引号


您的语法有错误,高度应在“500px”附近

应该是

 $(document).ready(function () {
$( "#cen" ).animate({
height:"500px",
width:"500px",
}, 5000, function() {
// Animation complete.
});
});

请签出此演示

使用此代码它正在工作

$(document).ready(function () {
$( "#cen" ).animate({
height:"500px",
width:"500px",
}, 5000, function() {
// Animation complete.
});
});

你导入jquery库了吗?顺便说一句,你的问题不是“不工作”。“不工作”意味着流程执行,但您可以看到结果。但抛出异常(如“意外令牌非法”)的代码不仅仅是“不工作”。请记住这一点,以备将来的问题。你能补充一些意见,说明它的作用以及它解决问题的原因吗?
$(document).ready(function () {
$( "#cen" ).animate({
height:"500px",
width:"500px",
}, 5000, function() {
// Animation complete.
});
});
$(document).ready(function () {

    $( "#cen" ).animate({

        height:"500px",
        width:"500px",
    }, 5000, function() {

    });

});