css: avoid image hover first time blinking

前端 未结 12 624
深忆病人
深忆病人 2020-12-07 19:52

I have an anchor that changes its background image when hovered with a class class-btn that contains a background-image.

When hovered, it

12条回答
  •  没有蜡笔的小新
    2020-12-07 20:29

    @Kristian's method of applying hidden 'content: url()' after the body didn't seem to work in Firefox 48.0 (OS X).

    However, changing "display: none;" to something like:

    body:after {
     position: absolute; overflow: hidden; left: -50000px;
     content: url(/path/to/picture-1.jpg) url(/path/to/picture-2.jpg);
    }
    

    ... did the trick for me. Perhaps Firefox won't load hidden images, or maybe it's related to rendering(?).

提交回复
热议问题