本文介绍了Chrome 在 RTL 语言站点上显示空白页面,直到调整窗口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个阿拉伯语版本的网站,并注意到 Chrome 有时会显示一个完全空白的页面,直到调整窗口大小,然后所有内容立即变得可见.

I just created an Arabic version a website and noticed that Chrome sometimes shows a totally blank page until the window is resized and then everything instantly becomes visible.

阿拉伯语是一种 RTL 语言,因此 标签添加了 dir="rtl" lang="ar" .这是它和英文网站的唯一区别.

Arabic is a RTL language, so the <html> tag has dir="rtl" lang="ar" added to it. This is the only difference between it and the English site.

这是网站.您可能需要多次单击徽标才能看到它显示为空白.

This is the site. You may have to click the logo a few times in order to see it show blank.

推荐答案

我也注意到了这个问题,我用英语和阿拉伯语搜索了互联网,但找不到问题的原因.不过,我找到了一种解决方法来修复它;在 rtl 导向的网页中使用以下 jQuery 脚本:

I've noticed this problem too and I searched the internet in English and Arabic but couldn't find the cause of the problem. I found a workaround to fix it though; use the following jQuery script in your rtl-directed webpages:

//Chrome RTL UI Issue Fix
$(document).ready(function(){
    $(window).load(function() {
        $( "body" ).animate({
            scrollTop: 1
        });
    });
});

它所做的只是在所有页面元素加载后立即将页面滚动1px.如果需要,您可以添加一个将其向后滚动的代码.

All it does is that it scrolls the page by only 1px right after all the page elements have been loaded. You can add a code that scrolls it back if you want.

这篇关于Chrome 在 RTL 语言站点上显示空白页面,直到调整窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 17:10