码迷,mamicode.com
首页 > Web开发 > 详细

伸缩放大的js

时间:2015-09-29 16:19:21      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

    window.onload = function() {
        var div1 = document.getElementById(‘div1‘);
        div1.onmouseover = function(){
             startMove(this,400);
        }
        div1.onmouseout = function(){
             startMove(this,200);
        }

        function startMove(obj, iTarget) {
            clearInterval(obj.timer);
            obj.timer = setInterval(
                function() {
                    var speed = (iTarget-obj.offsetHeight)/3;
                    obj.style.height = obj.offsetHeight + speed + ‘px‘;
                    obj.style.width = obj.offsetWidth + speed + ‘px‘;                
                }, 30)
        };
    }

伸缩放大的js

标签:

原文地址:http://www.cnblogs.com/Yirannnnnn/p/4846414.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!