IE background flicker

若如初见. 提交于 2019-12-06 10:28:03

问题


I have the problem that when I switch to other pages on the site, my background turns white and loads again. I know it has something to do with the IE cache and did some research about it. I already tried the most common fixes, both css and javascript, like the ones on this site: http://ieflicker.com/ but none of them works.

UPDATE (some code)

The site uses BODY with background-image: url('background1.jpg') as a part of its CSS. This seems to load image once and cache it in all the browsers but IE10. IE10 seems to reload it every time.


回答1:


Apparently IE10 doesn't cache image loaded via CSS despite all the hacks. You need to explicitly load it. E.g. if your body style mentions:

background-image: url('background1.jpg')

add this to your page's HTML:

<img src='background1.jpg' style='display:none' />

Now this will load and cache the image and the flicker will be avoided.



来源:https://stackoverflow.com/questions/18292107/ie-background-flicker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!