使用jQuery在背景图片中褪色 [英] Fading in background image with jQuery
本文介绍了使用jQuery在背景图片中褪色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您如何使用jQuery淡化背景图像(body标签,并将其平铺)?背景颜色是白色,在回调函数中,我想将背景图像切换为打开和关闭.
How would you fade in a background image (the body tag, and it is tiled) with jQuery? The background color is white and in a callback function I want to toggle the background image to on and off.
有什么想法吗?
推荐答案
不幸的是,您无法真正在平铺的背景图像中淡入淡出.由于图像是CSS渲染系统的一部分,因此DOM中没有节点.
Unfortunately you can't really fade in a tiled background image. Since the image is part of the CSS rendering system it doesn't have a node in the DOM.
您可以通过移动背景图像的位置来使用帧类型动画来做一些奇特的事情,但这不适用于:
You can do some fancy stuff by using a frame type animation by moving the position of the background image but this wouldn't work with:
A. a whole body background
B. a tiled image.
这篇关于使用jQuery在背景图片中褪色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文