• 一个鼠标滚轮控制大小的缩放类。


    //缩放类  兼容性良好
    var zoomClass = function(o){
        if (typeof(o) == "string")
            o = document.getElementById(o);
       
        if (document.attachEvent)
            o.attachEvent("onmousewheel", func);
        else
            o.addEventListener("DOMMouseScroll", func, false);
       
        function func(e){
            if (e.target) {
                var oWidth = e.target.width;
                var width = e.target.width + e.detail * 12;
                var height = oWidth / (width - oWidth);
                height = e.target.height / height;
                height = e.target.height + height;
                if (width > 0 && height > 0) {
                    e.target.width = width;
                    e.target.height = height;
                }
            }
            else {
                e = window.event;
                var currentZoom = parseInt(o.style.zoom, 10) || 100;
                currentZoom += event.wheelDelta / 12;
                if (currentZoom > 0)
                    o.style.zoom = currentZoom + '%';
            }
            return false;
        }
    }

    </script>

    使用方法   zoomClass("objId")

  • 相关阅读:
    mac下xcode中include path
    如何联机调试和发布程序
    Facebook 错误码
    app store给应用评分功能
    FTP传输模式
    重新安装 Visual Studio 6.0 的问题
    ASP项目:提示用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败
    投资项目的4P
    .net 的资源与本地化
    千万不能干的事(文摘)
  • 原文地址:https://www.cnblogs.com/yaojaa/p/1925894.html
Copyright © 2020-2023  润新知