简体   繁体   English

单击“页面跳转”链接时,网站的某些部分会消失

[英]Parts of website disappear when clicking “page jump” links

I have encountered a very weird problem. 我遇到了一个非常奇怪的问题。 Sometimes when I click page jump links, parts of the website become blank. 有时当我点击页面跳转链接时,网站的某些部分会变成空白。 If I hover a blank area, then all the website reappears. 如果我将鼠标悬停在空白区域,则会重新显示所有网站。 I can't use chrome inspect to debug this, because if I enable it everything becomes normal again. 我不能使用chrome inspect来调试它,因为如果我启用它,一切都会恢复正常。

It seems to be a Chrome bug and it only happened on two computer out of a total of 12 I tested this on. 它似乎是一个Chrome bug,它只发生在两台计算机中,总共有12台我测试了这个。

I am currently using Chrome Version 33.0.1750.154 m 我目前正在使用Chrome版本33.0.1750.154 m

One of the pages that have this problem is here . 其中一个有这个问题的页面就在这里

Here you can see a screenshot of the problem. 在这里,您可以看到问题的屏幕截图。

I have tried deleting cookies, history and cache, then tried on incognito and it still happens. 我已经尝试删除cookie,历史记录和缓存,然后尝试隐身,它仍然发生。

在此输入图像描述

I've run into this also and am pretty sure it has to do with accelerated rendering in Chrome. 我也遇到了这个问题,我很确定它与Chrome中的加速渲染有关。

I typically use one of two solutions, preferring the first when it works: 我通常使用两种解决方案中的一种,在工作时更喜欢第一种解决方案:

  1. If your markup allows, add a block-level container around the offending area. 如果您的标记允许,请在违规区域周围添加块级容器。 As I understand it, this creates a new layout boundary that will help define for the browser what areas need to be repainted when. 据我了解,这创建了一个新的布局边界 ,有助于为浏览器定义何时需要重新绘制的区域。

  2. Use JavaScript to force a repaint in the affected area when a page jump is clicked: 单击页面跳转时,使用JavaScript强制在受影响区域重绘:

    $('#page').on('click', '.jump', function() { $('#container-of-disappearing-section').hide().show(); }); $('#page')。on('click','。jump',function(){$('#container-of-disappearing-section')。hide()。show();});

That second approach isn't ideal for performance, but it's better than weird white gaps showing up on the page. 第二种方法不是理想的性能,但它比页面上显示的奇怪的白色间隙更好。

You could optimize a little further if you're already using something like Modernizr that could help you execute the script only in Chrome. 如果您已经使用了像Modernizr这样的东西,可以帮助您仅在Chrome中执行脚本,那么您可以进一步优化。 But that probably wouldn't be worthwhile unless you're already doing that sort of detection for some other feature on your site. 但这可能不值得,除非你已经对你网站上的其他功能进行了那种检测。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM