1

这是一个例子

在 IE9 和 chrome 中,按 ctrl + 放大 200%: 在此处输入图像描述

有没有办法通过使用缩放功能来调整帧大小?(如IE9)

参考:

4

1 回答 1

0

myFix.js

//fix webkit browsers
if ('WebkitAppearance' in document.documentElement.style) {
    document.onreadystatechange = function() {
        if (document.readyState != 'complete')
            return;

        var oldLevel = 1;
        //whether we're fixing 'rows' or 'cols'
        var checking = 'rows';
        var frameset = document.getElementById('set');
        //get the hard coded values from the html
        var values = frameset.getAttribute(checking).split(',');

        //make sure not to change any %'s or *'s
        var isPixels = new RegExp('[0-9]+');
        for (var index = 0; index < values.length; ++index) {
            if (isPixels.test(values[index]))
                values[index] = new Number(values[index]);
        }

        var zoomCheck = function() {
            //calculate zoom level
            var level = window.outerWidth / window.innerWidth;
            //if it hasn't changed, ignore
            if (oldLevel == level)
                return;

            var newValues = new Array(values.length);
            //copy each of the original values
            for (var index = 0; index < values.length; ++index) {
                newValues[index] = values[index];

                //fix the ones we are meant to
                if (values[index] instanceof Number)
                    newValues[index] *= level;
            }

            //apply the fix
            frameset.setAttribute(checking, newValues.join(','));
            oldLevel = level;
        };

        //periodically check
        setInterval(zoomCheck, 1000);
    };
}

你的.html

<html>
    <head>
        <!--your other stuff-->
        <script type="text/javascript" src="myFix.js"></script>
    </head>

    <frameset id="set" rows="200,*" frameborder="0" border="0" framespacing="0">
        <frame name="menu" src="menu_1.html" marginheight="0" marginwidth="0" scrolling="auto" noresize="">
        <frame name="content" src="content.html" marginheight="0" marginwidth="0" scrolling="auto" noresize="">
    </frameset>
</html>
于 2014-12-04T05:25:52.073 回答