问题

微信内置浏览器菜单里有一个调整字体功能,如果用户自己调整字体,有可能导致布局混乱。

以下是从网上找到的禁用调整字体的方法。

IOS

使用safari的test-size-adjust css属性覆盖微信样式。

body { 
    -webkit-text-size-adjust: 100% !important;
}

Android

使用微信内置WeixinJSBridge对象,将字体设置为默认大小,并重写菜单中的调整字体按钮的响应方法。

if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
    handleFontSize();
} else {
    if (document.addEventListener) {
        document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
    } else if (document.attachEvent) {
        document.attachEvent("WeixinJSBridgeReady", handleFontSize);
        document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
    }
}

function handleFontSize() {
    // 设置网页字体为默认大小
    WeixinJSBridge.invoke('setFontSizeCallback', {'fontSize': 0});
    // 重写设置网页字体大小的事件
    WeixinJSBridge.on('menu:setfont', function () {
        WeixinJSBridge.invoke('setFontSizeCallback', {'fontSize': 0});
    });
}

13 条评论

these g · 2020年6月20日 下午5:27

I’m impressed, I have to admit. Rarely do I come across a
blog that’s equally educative and amusing, and let
me tell you, you’ve hit the nail on the head.
The issue is something which not enough folks are speaking intelligently about.
I’m very happy I stumbled across this during my search
for something concerning this.

g use · 2020年6月21日 上午6:58

Heya i am for the first time here. I came
across this board and I in finding It really helpful & it helped me out a lot.
I am hoping to provide something again and help others such as you helped me.

g two · 2020年6月22日 上午2:52

I was wondering if you ever thought of changing the page layout of your blog?
Its very well written; I love what youve got to say. But maybe you could
a little more in the way of content so people could connect with it better.

Youve got an awful lot of text for only having 1 or two pictures.

Maybe you could space it out better?

https://tinyurl.com/rsacwgxy g · 2020年6月22日 上午5:14

I’m not sure why but this blog is loading extremely
slow for me. Is anyone else having this problem or is it
a issue on my end? I’ll check back later on and see if the problem still exists.

tinyurl.com · 2020年6月26日 下午1:25

Oh my goodness! Impressive article dude! Thank you so
much, However I am having troubles with your RSS.
I don’t know the reason why I can’t subscribe to it. Is there anybody having identical RSS problems?
Anybody who knows the solution will you kindly respond? Thanks!!

https://procheckinspect.com/cbd-oil-2/ · 2020年6月27日 上午2:57

Does your blog have a contact page? I’m having trouble locating
it but, I’d like to send you an e-mail. I’ve got some ideas for your
blog you might be interested in hearing. Either way, great blog and I look
forward to seeing it develop over time.

http://tinyurl.com · 2020年6月27日 上午6:06

Have you ever thought about adding a little bit
more than just your articles? I mean, what you say is
valuable and all. Nevertheless think about if you added some great pictures or video
clips to give your posts more, “pop”! Your content is excellent but with pics
and videos, this blog could definitely be one of the greatest in its field.
Very good blog!

anthinhminerals.vn · 2020年6月27日 上午7:23

This is my first time go to see at here and i am really
impressed to read all at single place.

cbd oil that works 2020 · 2020年6月27日 下午6:24

Very quickly this web site will be famous amid all blog visitors,
due to it’s pleasant content

cbd oil that works 2020 · 2020年6月28日 上午8:54

Thanks for a marvelous posting! I definitely enjoyed reading it, you could be a great author.I will be sure to
bookmark your blog and may come back sometime soon.
I want to encourage you continue your great job,
have a nice weekend!

cbd oil that works 2020 · 2020年6月28日 上午9:47

I really like what you guys are usually up too.
This kind of clever work and exposure! Keep up the wonderful works guys I’ve included you guys to blogroll.

cbd oil that works 2020 · 2020年6月29日 上午11:32

If some one desires expert view concerning blogging afterward i suggest him/her
to pay a quick visit this web site, Keep up the fastidious
job.

cbd oil that works 2020 · 2020年6月29日 上午11:38

Hi are using WordPress for your blog platform? I’m new to the blog world but I’m trying to get
started and set up my own. Do you need any
html coding knowledge to make your own blog? Any help would be greatly appreciated!

发表评论

电子邮件地址不会被公开。 必填项已用*标注