[英]body background-image fade in
Use an image as a background image. 将图像用作背景图像。 ie,
<img />
tag. 即
<img />
标签。 Then use jQuery's .animate()
function: 然后使用jQuery的
.animate()
函数:
$(document).ready(function(){
$('img.bg').animate({
opacity: 1;
}, 1000);
});
CSS: CSS:
.bg {opacity: 0; position: absolute; top: 0; left: 0; width: 100%; height: 100%;}
HTML: HTML:
<img src="bgimage.png" class="bg" />
Working demo http://jsfiddle.net/9HTkV/ (and coz I like hulk) :P 工作演示 http://jsfiddle.net/9HTkV/ (而且我喜欢绿巨人):P
Start with opacity 1
and then make it zero as it is fade in. 从不
opacity 1
开始,然后随着其淡入度将其设为零。
This should help :)
这应该有帮助
:)
code 码
$('.box2').animate({
opacity: 0
});
CSS in start you want Opacity to be 1 and then make it 0. 首先,您希望CSS的不透明度为1,然后使其为0。
.box2 {
height: 500px;
width: 700px;
background: #000000;
opacity: 1;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.