zoukankan      html  css  js  c++  java
  • jQuery和css相结合制作动画----jQuery中animate方法不支持transform属性的解决方案

    <!DOCTYPE html>
    <html>
            <meta charset="utf-8">
            <meta name="viewport" content="width=width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
            <title>jQuery和css相结合制作动画----jQuery中animate方法不支持transform属性的解决方案</title>
    <head>
        <style>
        .m-test {
             100px;
            height: 100px;
            background: red;
            position: relative;
        }
        .m-animation {
            transform: translate(0px, 100px);
            transition: all 0.5s ease-in-out;
        }
        </style>
        <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
    </head>
    
    <body>
        <div class="m-test" id="m-test"></div>
        <script>
        $(function() {
            var myAction = {};
            var dom = {
                test: $('#m-test')
            };
    
            $.extend(myAction, {
                initAnimation: function() {
                    //dom.test.addClass('m-animation');
                    dom.test.css({ transform: 'translate(0px, 100px)', transition: 'all 0.5s ease-in-out' });
                }
            });
    
            var init = function() {
                myAction.initAnimation();
            }();
        })
        </script>
    </body>
    
    </html>
  • 相关阅读:
    Java入门
    Java入门
    Java入门
    Java入门
    Java入门
    Java入门
    Java入门
    Java入门
    leyou_04_vue.js的ajax请求方式
    leyou_03_cors解决ajax的跨域请求问题
  • 原文地址:https://www.cnblogs.com/xutongbao/p/9924814.html
Copyright © 2011-2022 走看看