停止按柳,随时停,停所有操作

原创 2018-11-21 23:59:59 189
摘要:<!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)
            })
            $('#stop').click(function(){
                $('div').stop()
            })
        })
    </script>
</head>
<body>
    <button class="but1">字体放大按柳</button>
    <p>jQuery中我们使用animate()方法创建自定义的动画</p>
    <button class="but2">改变div按柳</button>
    <button id="stop">停止按柳</button>
    <div></div>
</body>
</html>


批改老师:韦小宝批改时间:2018-11-22 09:13:26
老师总结:不错不错!代码很完整!下次记得再加点总结就更不错了哦!

发布手记

热门词条