日期:2014-05-16  浏览次数:20554 次

jquery动画为什么延迟执行?

<!DOCTYPE html>
<html>
<head>
    <title>Display Page</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="jquery-1.9.1.js"></script>
</head>
<body>
    <div id="transform" style="width: 300px;height:60px;background: blue;">
        <input type="text" style="width: 240px;left: 30px;top:20px;position: relative;">
    </div>
    <script type="text/javascript">
        $("input[type='text']").focus(function () {
            var elem = $('#transform');
            elem.animate({
                width:"500px",
                height:"200px"
            }, 1000);
            $(this).animate({
                width:"420",
                left:"40"
            }, 1000).blur(function () {
                        elem.animate({
                            width:"300px",
                            height:"60px"
                        }, 1000);
                        $(this).animate({
                            width:'240px',
                            left:'30px'
                        }, 1000);
                    });
        });
    </script>
</body>
</html>

让焦点在文本框中获得、失去,重复几次,为什么动画效果开始执行的时间越来越慢?基本上点击几次,就延时几秒执行
jquery

------解决方案--------------------
引用:
引用:你把focus和blur分开写试试
XML/HTML code?123456789