开发者

CSS .Hover Image Loading Slow

开发者 https://www.devze.com 2022-12-24 04:11 出处:网络
I have a submit button that changes when the user hovers his mouse over it.Right now the image is taking a while to load and you get a 开发者_开发问答half second where there is white screen instead of

I have a submit button that changes when the user hovers his mouse over it. Right now the image is taking a while to load and you get a 开发者_开发问答half second where there is white screen instead of the other button. Is there anyway to improve this using just CSS and HTML or do I need to do some JS work?


Use a sprite image, and then toggle background position on hover. That ensures that the image being displayed on hover has already been downloaded.


CSS Sprites

And load the css sprites when DOM is ready, this can sort of "preload" the image before user hovers on the submit button :)

0

精彩评论

暂无评论...
验证码 换一张
取 消