zoukankan      html  css  js  c++  java
  • 一个鼠标滚轮控制大小的缩放类。

    //缩放类  兼容性良好
    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")

  • 相关阅读:
    ◆◆0凭证(Tcode)跳转(SET PARAMETER ID)
    [问题解决]ALV新加字段不显示
    8-Noise & Error
    5-ML的可行性(2)
    4-ML的可行性(1)
    6-ML的可行性(3)
    1-ML的基本概念
    基于SmartQQ协议的QQ聊天机器人-8
    基于SmartQQ协议的QQ聊天机器人-7
    基于SmartQQ协议的QQ聊天机器人-6
  • 原文地址:https://www.cnblogs.com/yaojaa/p/1925894.html
Copyright © 2011-2022 走看看