IE7 放大时页面居中

发布于 2024-07-26 01:41:08 字数 237 浏览 4 评论 0原文

我正在为一位客户建立一个网站,他希望他们的页面在 IE7 中完美缩放。 我终于设法解决了大部分错误,但只有一个。

当您放大页面时,它会很好地居中,但是当您转到另一个页面时,页面会呈现并显示在页面的左上角。 我需要让它渲染居中。 我知道这是可能的(客户不断将其与具有此功能的 bbc.co.uk 进行比较)。

有谁知道我可以添加到我的身体标签或其他东西中的修复程序吗?! 如果您需要查看任何代码,请告诉我。

I am building a website for a client who wants their page to zoom perfectly in IE7. I have finally managed to get around most of the bugs, but one.

When you zoom in on the page, it centers fine, but then when you go to another page, the page renders and displays the top left of the page. I need to make it render centered. I know it is possible (the client keeps comparing it to bbc.co.uk which has this feature).

Does anyone know of a fix I can add to my body tag or something?! Let me know if you need to see any code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏九 2024-08-02 01:41:08

将您的网站包装在容器 div 中;

<div id="wrapper">
...
</div>

和CSS;

#wrapper {
margin: 0 auto;
width: XXXpx;
}

应用到它上面就达到了预期的效果。

(其中宽度表示布局的宽度)。

缩放居中,并且在缩放状态下浏览页面时保持居中。 在 VMware XP 上的 ie7 中进行了测试。

Wrapping your site in a container div;

<div id="wrapper">
...
</div>

and the css;

#wrapper {
margin: 0 auto;
width: XXXpx;
}

applied to it has the desired effect.

(Where width represents the width of the layout).

Zooms centered, and when moving through pages in the zoomed state stays centered. Tested in ie7 on VMware XP.

瞎闹 2024-08-02 01:41:08

当缩放/缩放时,IE的中心点似乎在左上角
我通过脚本移动到中心

$.browser.mozilla
    ? $container.css('-moz-transform', 'scale(' + scale + ')')
    : $container.css('zoom', scale)

winW = $(window).width()
winH = $(window).height()

if ($.browser.msie) {
    var offScale = (1 - scale) / 2
    $container.css({
        top   : winH * offScale
      , left  : winW * offScale
})

你必须知道秤号和我的 $container 位置是“绝对”

When scale/zoom, the center point of IE seems at the top-left
I move to the center by scripts

$.browser.mozilla
    ? $container.css('-moz-transform', 'scale(' + scale + ')')
    : $container.css('zoom', scale)

winW = $(window).width()
winH = $(window).height()

if ($.browser.msie) {
    var offScale = (1 - scale) / 2
    $container.css({
        top   : winH * offScale
      , left  : winW * offScale
})

You must know the scale number and my position of $container is "absolute"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文