加载图片后如何淡入效果?

u010184133 2013-04-21 09:47:58
加载图片后
怎么加淡入效果?
代码如下:
onload = function() {
$('#bg').attr('src','1.jpg');
}
...全文
157 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaomeimei_2011 2013-04-22
  • 打赏
  • 举报
回复
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <!-- 引入jQuery --> <script src="../scripts/jquery-1.3.1.js" type="text/javascript"></script> <style> .header{ background:#fff url(images/banner_05a.jpg) no-repeat; height:133px; width:963px; float:left; position:relative; } .header img { vertical-align:top; position:absolute; right:0; } </style> <script language="javascript" type="text/javascript"> $(function(){ $(".header img").fadeOut(0).eq(0).fadeIn(0); var i = 0; setInterval(function(){ if($(".header img").length > (i+1)){ $(".header img").eq(i).fadeOut(2000).next("img").fadeIn(2000); i++; } else{ $(".header img").eq(i).fadeOut(2000).siblings("img").eq(0).fadeIn(2000); i = 0; } },3000); }) </script> </head> <body> <div class="header"> <img alt="JQuery实现淡入淡出效果" src="templatemo_image_01.jpg"> <img alt="JQuery实现淡入淡出效果" src="templatemo_image_02.jpg"> <img alt="JQuery实现淡入淡出效果" src="templatemo_image_03.jpg"> </div> </body> </html> 试一下!
hzyrs0820 2013-04-22
  • 打赏
  • 举报
回复
引用 3 楼 xiehaiyan_blue 的回复:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <!-- 引入jQuery --> <sc……
我也正在研究这问题,借鉴下
u010184133 2013-04-21
  • 打赏
  • 举报
回复
引用 1 楼 mycoolaccount 的回复:
用fadeIn()
怎么用
mycoolaccount 2013-04-21
  • 打赏
  • 举报
回复
用fadeIn()

87,991

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧