img之优雅的切换

*、img中有时会出现这样的需求:切换但动的img中的src属性

已知:
直接替换src中的路径,图片会直接显示
解决办法:
延时函数
源码:
//延时添加超链接,实现前一个照片的淡出
//后一个照片的淡入
$("#pic").fadeOut(picPeriodOut);
setTimeout(function() {
	$("#pic").attr("src",url);
},picPeriodOut);
$("#pic").fadeIn(picPeriodIn);

猜你喜欢

转载自lbovinl.iteye.com/blog/2374126
今日推荐