wyfangg
V2EX  ›  问与答

关于网页等比例缩放问题

  •  
  •   wyfangg · Sep 19, 2023 · 1216 views
    This topic created in 987 days ago, the information mentioned may be changed or developed.

    网页暂时自适应只支持最小到 1440 宽度,所以为了临时适配更小宽的的 ipad 设备,临时写了一个缩放代码,当宽度小于 1440 时,直接把 1440 宽度的页面等比例缩放。在电脑的 Chrome 上发现正常显示,但在 safari 中,发现当触发缩小代码后,页面中的字体如果字号在 9px 到 22px 之间,则字体只会显示 22px 的大小,这是为什么?

    百度的代码:

    $(window).resize(function () { var win = $(this).width(); if (win < 1440) { //宽度小于 1440 时,按 1440 和窗口实际宽度计算等比 $("body").css("zoom", win / 1440); }else{ $("body").css("zoom", "normal"); } }).trigger('resize');

    观察检视中,就是它右侧有个特性,它里面显示的字号,当左侧修改 9 至 22 ,它都是显示 27.422449px: https://i.imgur.com/MibnvcT.jpeg

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5651 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 07:09 · PVG 15:09 · LAX 00:09 · JFK 03:09
    ♥ Do have faith in what you're doing.