第一次动画效果

Original 2018-11-21 23:53:16 212
abstract:<!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <title>jQuery自定义动画</title>   &nbs
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>jQuery自定义动画</title>
    <style type="text/css">
        div{
            width: 200px;
            height: 200px;
            background: red;
            border: 5px #000;
            position: absolute;
        }
    </style>
    <script src="jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.but1').click(function(){
                $('p').animate({fontSize:'40px'},1500)//属性名称一律改成驼峰写法
            })

            //同时操作多个css属性
            //使用预定义的值show hide toggle
            $('.but2').click(function(){
                $('div').animate({
                    // left:'400px',
                    // opacity:'0.3',
                    // height:'400px',
                    // width:'400px'
                    width:'toggle',
                    height:'toggle'
                },1500)
            })
        })
    </script>
</head>
<body>
    <button class="but1">字体放大按柳</button>
    <p>jQuery中我们使用animate()方法创建自定义的动画</p>
    <button class="but1">改变div按柳</button>
    <div></div>
</body>
</html>

怎么Sublime复制过来button里的class就不见了呢

Release Notes

Popular Entries